日期:2014-05-19  浏览次数:20645 次

助人为快乐之本:菜鸟问题:Winform关于C#实现套打功能
想用C#写个Winform程序,实现套打功能。例如平时的体检表那样的表格,他们都有固定的格式,我们要在相应的地方填写,如姓名,年龄等信息。现在想用程序实现:表格都已经印好了,只将应该填写的信息(姓名、年龄等)打印上去,这些信息存储在数据库中。
我想有相应的预览功能,即原先固定的表格和数据合成在一起。表格需要自己画吗?有没有什么组件能够将表格画出来啊?ComponentOne里有吗?如果表格画出来了,那数据库的数据怎么填到表格中啊?是不是我的思路直接就不对〉?这个东西是不是要用组件来实现?
希望各位大虾抽出点时间给提供点思路,谢谢了!有示例性的代码更好。帮帮忙啊!


------解决方案--------------------
不清楚...
帮顶
JF
------解决方案--------------------
vs2005中的打印功能还是很强的啊,可以用下面的代码试试看!

private System.Windows.Forms.Button cmdPrint;
private System.Drawing.Printing.PrintDocument printDocument;
private System.Windows.Forms.PrintDialog printDialog;

private void cmdPrint_Click(object sender, EventArgs e)
{
this.printDialog.Document = this.printDocument;
this.printDialog.ShowDialog();

this.printDocument.Print();

}

private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{//这里可以任意的画线,写字
e.Graphics.DrawString( "Hello ",new Font( "黑体 ",40),new SolidBrush(System.Drawing.Color.Red),0,0);
e.Graphics.DrawLine(new Pen(new SolidBrush(System.Drawing.Color.Red), 10), new Point(0, 0), new Point(300, 500));
}

水晶报表可以解决更复杂的打印.

Good Luck!
Tony!
------解决方案--------------------
Mark