急 c# winform 自定义打印行的内容 用水晶报表画好你要打印的内容,将报表扔到CrystalReportViewer中(设置其ReportSource属性),最后调用CrystalReportViewer.PrintReport()方法,就输出到打印机了。VS2005/2008 带有水晶报表的简版。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 得用GUI+ 不过你这样的貌似不难 参考MSDN 使用PrintDocument然后向里面画内容 可以考虑其他控件,如Aspose做这方面的东西很好 参考C# WinForm开发系列 - Print 用CrystalReportViewer和PrintDocument 我知道 但是不知道怎么处理动态的东西,比如消费的项目的数量并不是固定的,可能只有一个,也可能有几个,也可能有几十个。GUI+好像是画图之类的吧 fastreport 和 Aspose 更不会用,头一次听说 呵呵参考C# WinForm开发系列 - Print 我还在看希望能给个具体的例子 关键是动态的地方我现在的代码是: String text0 = ""; String text1 = ""; //获取文本框的内容绘制图形传到打印机打印 text0 = this.textBox1.Text; text1 = this.label1.Text; e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0); e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0, 50); e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue, 0, 100); 最近比较忙,没有及时结贴,先结贴解决方法就像我的代码:String text0 = ""; String text1 = ""; //获取文本框的内容绘制图形传到打印机打印 text0 = this.textBox1.Text; text1 = this.label1.Text; e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0); e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 20, 0); e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue, 40, 0);我把横坐标设置成变量 然后判断要打印的内容是否存在就可以解决了如我申明 string a=20;我的代码就是String text0 = ""; String text1 = ""; //获取文本框的内容绘制图形传到打印机打印 text0 = this.textBox1.Text; text1 = this.label1.Text; e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0); if (texti存在值){ e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, a, 0); a=a+20;} e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue,a , 0);结贴 错了 应该是 Int a=20; HTML里面的Select标签设置默认值 为什么么这个给原始图加水印的方法会把原图压缩很多?!! 全身家当,求一思路,顶者有分 如何从数据库链接字符串中提取有用信息 我想实现通过浏览器对局域网内共享文件的访问 求助:用C# Graphics画图,出现锯齿,怎么消除 关于画时序图,来帮下小弟吧 经理给一个小项目,是(C#)C/S模式的有关人事管理方面的,我以前写的都是B/S的. 200分求解异步服务端套接字异常 C#弹出窗口 使用WMEncoder中视频源设备的属性窗体如何调用(高分求解) 关于邮件发送的问题
然后向里面画内容
我知道 但是不知道怎么处理动态的东西,
比如消费的项目的数量并不是固定的,
可能只有一个,也可能有几个,也可能有几十个。
GUI+好像是画图之类的吧
fastreport 和 Aspose 更不会用,头一次听说 呵呵参考C# WinForm开发系列 - Print 我还在看希望能给个具体的例子 关键是动态的地方我现在的代码是: String text0 = ""; String text1 = "";
//获取文本框的内容绘制图形传到打印机打印
text0 = this.textBox1.Text;
text1 = this.label1.Text;
e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0);
e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0, 50);
e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue, 0, 100);
先结贴
解决方法就像我的代码:
String text0 = ""; String text1 = "";
//获取文本框的内容绘制图形传到打印机打印
text0 = this.textBox1.Text;
text1 = this.label1.Text;
e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0);
e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 20, 0);
e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue, 40, 0);我把横坐标设置成变量 然后判断要打印的内容是否存在就可以解决了如我申明 string a=20;
我的代码就是
String text0 = ""; String text1 = "";
//获取文本框的内容绘制图形传到打印机打印
text0 = this.textBox1.Text;
text1 = this.label1.Text;
e.Graphics.DrawString(text0 + text1,new Font("宋体", 30, FontStyle.Regular), Brushes.Black, 0,0);
if (texti存在值)
{
e.Graphics.DrawString(text1, new Font("宋体", 30, FontStyle.Regular), Brushes.Black, a, 0);
a=a+20;
}
e.Graphics.DrawString("___________________________________________", new Font("宋体", 30, FontStyle.Regular), Brushes.Blue,a , 0);结贴