我有一个带有tablelayoutpanel的winform,它包含几个我根据调用函数(字符串列表)的输入更改的标签
我使用标签,因为它更容易更改字体等...并在屏幕上看到它
但是当我要打印它时,我会得到空白页, 使用
private void CaptureScreen()
{
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}
答案 0 :(得分:0)
尝试使用DrawToBitmap()
,如下所示:
private void CaptureScreen()
{
memoryImage = new Bitmap(this.Size.Width, this.Size.Height);
this.DrawToBitmap(memoryImage, new Rectangle(new Point(0, 0), this.Size));
}