Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# c如何打印表格中的信息?_C#_.net_Printing - Fatal编程技术网

C# c如何打印表格中的信息?

C# c如何打印表格中的信息?,c#,.net,printing,C#,.net,Printing,我正在使用此代码打印 System.Drawing.Font printFont = new System.Drawing.Font ("Arial", 35, System.Drawing.FontStyle.Regular); System.Drawing.Font valueFont = new System.Drawing.Font("Arial", 20, System.Drawing.FontStyle.Regular); // Draw the

我正在使用此代码打印

System.Drawing.Font printFont = new System.Drawing.Font
        ("Arial", 35, System.Drawing.FontStyle.Regular);

    System.Drawing.Font valueFont = new System.Drawing.Font("Arial", 20, System.Drawing.FontStyle.Regular);

    // Draw the content.
    e.Graphics.DrawString(text, printFont, 
        System.Drawing.Brushes.Black, 10, 10);
    e.Graphics.DrawString("asdfasdf", valueFont, System.Drawing.Brushes.Red, 20, 20);
如您所见,我正在设置打印值的位置,如下所示:

------------------------
label1:    textbox1.Text
------------------------
label2:    textbox2.Text
------------------------
10,10

20,20

这就是结果:

我的问题是:有没有办法让c自动设置位置

我希望有一种方法可以将数据打印为表格,因为我有52个文本框,我希望打印页面如下:

------------------------
label1:    textbox1.Text
------------------------
label2:    textbox2.Text
------------------------

将您的数据写入RichTextBox、WebBrowserControl等,并使用它们的打印功能。@L.B我已经完成了我的项目,我仍然需要进行打印。因此,我现在无法更改应用程序。我已经有52个复选框与验证和网络流。我无法将它们更改为任何其他控制器。有没有办法解决我的问题?它不需要改变整个项目。您将把数据写入控件并打印出来,而不是使用抽绳。@L.B您能给我举一个有标签和文本框的示例吗?我感谢你的邀请help@L.B请检查我的解决方案