日期:2014-05-17 浏览次数:21015 次
//mw为主窗体
public FullWindow(Window mw)
{
InitializeComponent();
this.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
this.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
this.Left = 0;
this.Top = 0;
this.MouseDown+=
delegate{
this.Close();
if (mw != null && mw.Visibility == Visibility.Hidden)
mw.Show();
};
double iHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
double iWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
//创建一个和屏幕一样大的bitmap
System.Drawing.Image img = new Bitmap((int)iWidth, (int)iHeight);
//从一个继承自image类的对象中创建Graphics对象
Graphics g = Graphics.FromImage(img);
//抓取全屏幕
g.CopyFromScreen(new System.Drawing.Point(0, 0), new System.Drawing.Point(0, 0), new System.Drawing.Size((int)iWidth, (int)iHeight));
tpath= AppDomain.CurrentDomain.BaseDirectory.Replace(@"bin\Debug", "Images") + "1.bmp";
img.Save(tpath, ImageFormat.Bmp);
//以下代码将img设置为全屏窗体的背景图片。