上面是调用WinAPI方式的,用.NET自带的类方式如下。
Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics gs = Graphics.FromImage(bmp); gs.CopyFromScreen(0, 0, 0, 0, new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)); this.pictureBox1.Image = bmp;
|
请发表评论