110,534
社区成员
发帖
与我相关
我的任务
分享
Bitmap img = new Bitmap(
this.dataGridView1.ClientSize.Width,
this.dataGridView1.ClientSize.Height);
this.dataGridView1.DrawToBitmap(img,
this.dataGridView1.ClientRectangle);
this.pictureBox1.Image = img;
Bitmap bmp = new Bitmap(dataGridView1.Width, dataGridView1.Height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(new Point(this.Location.X + dataGridView1.Location.X, (this.Height - this.ClientRectangle.Height) + this.Location.Y + dataGridView1.Location.Y), new Point(0, 0), new Size(dataGridView1.Width, dataGridView1.Height));
IntPtr dc1 = g.GetHdc();
g.ReleaseHdc(dc1);
bmp.Save(@"c:\1.jpg");
private void 截图ToolStripMenuItem_Click(object sender, EventArgs e)
{
Bitmap myImage = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
Graphics g = Graphics.FromImage(myImage);
g.CopyFromScreen(this.PointToScreen(new Point(this.dataGridView1.Location.X,this.dataGridView1.Location.Y)), new Point(0, 0), new Size(this.dataGridView1.Width, this.dataGridView1.Height));
IntPtr dc1 = g.GetHdc();
g.ReleaseHdc(dc1);
myImage.Save(@"c:\screen1.jpg");
}
private void button3_Click(object sender, EventArgs e)
{
Bitmap myImage = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(myImage);
g.CopyFromScreen(new Point(this.Location.X, this.Location.Y), new Point(0, 0), new Size(this.Width, this.Height));
IntPtr dc1 = g.GetHdc();
g.ReleaseHdc(dc1);
myImage.Save(@"c:\screen1.jpg");
}