c# how to print information in table?

大憨熊 提交于 2020-02-06 03:45:13

问题


I am using this code to print

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);

as you see, I am setting the location of the printing values like this:

10,10

and

20,20

and this is the result:

my question is: is there a way to make c# set the location automatically?

I would prefer If there is a way to print the data as table because i have 52 textbox and I would like the printing page to be like this:

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

来源:https://stackoverflow.com/questions/25218779/c-sharp-how-to-print-information-in-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!