【问题标题】:how to print the content of a tablelayoutpanel in C#如何在 C# 中打印表格布局面板的内容
【发布时间】:2015-03-25 13:42:04
【问题描述】:

我有一个带有 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);
}

How to: Print a Windows Form

【问题讨论】:

    标签: c# winforms printing label tablelayout


    【解决方案1】:

    尝试像这样使用DrawToBitmap()

        private void CaptureScreen()
        {
            memoryImage = new Bitmap(this.Size.Width, this.Size.Height);
            this.DrawToBitmap(memoryImage, new Rectangle(new Point(0, 0), this.Size));
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-18
      • 1970-01-01
      • 1970-01-01
      • 2020-06-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多