首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#打印字符串,该如何解决

2012-04-17 
C#打印字符串如题,有一字符串 string strXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX怎么将其打印出来~ 谢谢了~[

C#打印字符串
如题,有一字符串 string str="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
怎么将其打印出来~ 谢谢了~

[解决办法]
用printPreviewDialog和printDocument控件

C# code
private void button1_Click(object sender, EventArgs e)        {                printPreviewDialog1.ShowDialog();                printPreviewDialog1.Document = printDocument1;        }private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)        {                e.Graphics.DrawString(str, new Font("宋体", 10, FontStyle.Regular), new SolidBrush(Color.Black), 50, 160);        } 

热点排行