日期:2014-05-18 浏览次数:21544 次
private void SetBackground(System.Drawing.Bitmap bitmap)//设置窗体的背景图片
{
System.Windows.Media.ImageBrush ib = new System.Windows.Media.ImageBrush();
IntPtr ip = bitmap.GetHbitmap();
ib.ImageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip,IntPtr.Zero,Int32Rect.Empty,System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
this.这是你的控件名.Background = ib;
}
------解决方案--------------------