我使用以下几行来制作屏幕截图,但图像并不是特定于控制......它是在控制范围之外拍摄的。
Rectangle rect = new Rectangle(this.tableLayoutPanel1.Location.X,
this.tableLayoutPanel1.Location.Y, tableLayoutPanel1.Width, tableLayoutPanel1.Height);
Bitmap bmp = new Bitmap(rect.Width, rect.Height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(rect.Left, rect.Top, this.tableLayoutPanel1.Location.X,
this.tableLayoutPanel1.Location.Y, bmp.Size, CopyPixelOperation.SourceCopy);