110,534
社区成员
发帖
与我相关
我的任务
分享
private void button2_Click(object sender, EventArgs e)
{
Bitmap screenBitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(screenBitmap);
g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
g.Dispose();
this.pictureBox1.Image = screenBitmap;
}
Bitmap screenBitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(screenBitmap);
g.CopyFromScreen(20, 80, 0, 0, Screen.PrimaryScreen.Bounds.Size);
g.Dispose();
screenBitmap.Save("d:\\a.jpg"); // 保存的文件,打开显示OK
this.pictureBox1.Image = screenBitmap;
this.pictureBox1.BackColor = Color.Black; // 这里如果设置为Color.Red,就会看到那些失真的部分成了红色.