求一思路,关键字:报表,打印,winform 没做过报表开发以及打印的程序,现在我有个数据库,把相应数据读取出来,浏览后可以打印,应该怎么做?比如说,先读取到窗体中,然后再用打印控件打印?(听说winform有打印控件,还没用过)还是有什么其他好的办法,给点资料或链接也可以啊,谢过了!O(∩_∩)O谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 水晶报表http://blog.csdn.net/benbenRH/archive/2008/10/08/3037067.aspx 呵呵呵,我做了个例子,不过使用VB做的,都差不多啦,你自己去看看,QQ 1033005200 可以传给你 哟西,小日本死啦死啦地 PULL模式PUSH模式楼主可通过这两篇文章先找找感觉。 可以试试先把数据库里的内容导出到datagridview,然后用printDocument打印datagridview里的内容,感觉也蛮好用的! winform中自带打印和导出的功能,你试试就知道了!推荐你去看下 微软讲师 邵志东的水晶报表视频(很用帮助)免费下载!!! 我也是初学者!! 打印控件printDocument private void 打印ToolStripMenuItem_Click(object sender, EventArgs e) { try { printDialog1.Document = printDocument1; if (printDialog1.ShowDialog() == DialogResult.OK) { printDocument1.Print(); } } catch { MessageBox.Show("未安装打印机!"); } }将数据读到richtextbox里面private void Form1_Load(object sender, EventArgs e) { SqlConnection mysql = new SqlConnection(); mysql.ConnectionString = "Data Source=localhost;Initial Catalog=xsgt;Integrated Security=True"; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = mysql; sqlCommand.CommandType = CommandType.Text; //sqlCommand.CommandText = "SELECT * FROM Major"; sqlCommand.CommandText = "SELECT * FROM mm"; mysql.Open(); SqlDataReader sqlDateRreader; sqlDateRreader = sqlCommand.ExecuteReader(); /* while (sqlDateRreader.Read()) { richTextBox1.Text += " "+ sqlDateRreader["majorID"].ToString() + "\t" + sqlDateRreader["majorname"].ToString() + "\r"; }*/ while (sqlDateRreader.Read()) { richTextBox1.Text += " " + sqlDateRreader["username"].ToString() + "\t" + sqlDateRreader["code"].ToString() + "\r"; } Console.WriteLine(richTextBox1.Text); mysql.Close(); sqlDateRreader.Close(); } 用printDocument打印datagridview里的内容?怎么打啊,昨天试了很久没反应 将要打印的信息放到一个panel里面然后将panel绘成张图片最后打印这张图片就可以了 自建SMTP邮件服务器如何统计发送数据? pda pictureBox Outofmemoryexception 求一正则 , 前面是字符串A,后面是字符串B,求出这样的字串集合. 安装TFS2008的问题,急,在线等 如何比较时间的大小呢? ******不只是生成excel,还要求对里面的"城市"进行分组(up有分)******** 大家帮看看,是在是找不到什么地方有问题~ 谢谢了 通用的测试程序 Hr["001"]=e1;//set 有 几个小的C#程序要写,有兴趣的朋友可与我联系! 调用控制台难题 请问在form中如何实现web方式下的table形式?
http://blog.csdn.net/benbenRH/archive/2008/10/08/3037067.aspx
哟西,小日本死啦死啦地
PUSH模式楼主可通过这两篇文章先找找感觉。
private void 打印ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
printDialog1.Document = printDocument1; if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
catch
{
MessageBox.Show("未安装打印机!");
}
}
将数据读到richtextbox里面
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection mysql = new SqlConnection();
mysql.ConnectionString = "Data Source=localhost;Initial Catalog=xsgt;Integrated Security=True";
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.Connection = mysql;
sqlCommand.CommandType = CommandType.Text;
//sqlCommand.CommandText = "SELECT * FROM Major";
sqlCommand.CommandText = "SELECT * FROM mm";
mysql.Open();
SqlDataReader sqlDateRreader;
sqlDateRreader = sqlCommand.ExecuteReader();
/* while (sqlDateRreader.Read())
{
richTextBox1.Text += " "+ sqlDateRreader["majorID"].ToString() + "\t"
+ sqlDateRreader["majorname"].ToString() + "\r"; }*/
while (sqlDateRreader.Read())
{
richTextBox1.Text += " " + sqlDateRreader["username"].ToString() + "\t"
+ sqlDateRreader["code"].ToString() + "\r"; }
Console.WriteLine(richTextBox1.Text);
mysql.Close();
sqlDateRreader.Close();
}
然后将panel绘成张图片
最后打印这张图片就可以了