我用C#在VS2003下开发WINFORM程序,要将我的SELECT person.id as 编号,person.name as 姓名,person.photo as 照片 FROM PERSON WHERE PERSON.id=10 (其中photo 为本image 16)的一条记录结果添加入DataSet中,如何将记录中的文字和图片按指定的格式(如该条记录内容的每一个字段的打印的起始上边距和左边巨,图片的位置等)打印出来呢?
例按如下格式打印: 编号:1005203077 照片: |-----------|
姓名:张四 | |
| |
| |
|___________|
小弟菜鸟,请大峡给个完整的例子!!!
解决方案 »
- 【高分求助】请问用HttpRequest Post登录某论坛,返回的COOKIE为空,好像是论坛设置JS产生COOKIE的原因
- 各位大婶 歇歇脚
- 对象序列化后加密解密的问题?BinaryFormatter和Cryptostream
- 实现多线程例子
- datagrid的paint方法
- [求助]请教C#如何实现这种效果(关于DataGrid的)
- 求教一个sql
- DataGridView控件有关问题(着急)
- 问下gridview中添加一列选择框checkbox的问题
- 我有.net框架了,应该可以用命令提示 来编译,但应该怎么做呢?》
- 关于treeview提取数据库显示的问题
- 刷新dataGrid的问题
你在csdn里搜一下,前段时间出现过这样的问题。
1.直接画,来个PrintDocument类呀
2.用报表吧,CrystalReport都不错的。
我想把我用存储过程动态查询出来的结果 让CrystalReport显示出来,查了很多资料,听说要用“推”的技术。大侠给一段代码吧!
if(dtPic.Rows.Count>0)
{
DataTable myDataTable = new DataTable("we");//新建数据集存储图片的二进制信息
DataColumn myDataColumn = new DataColumn("pic",System.Type.GetType("System.Byte[]"));
myDataTable.Columns.Add(myDataColumn);
for(int i =0;i<dtPic.Rows.Count;i++)
{
string strPath = Server.MapPath("pic");
string bingstring =dtPic.Rows[i]["picture"].ToString();
bingstring = bingstring.Remove(0,7);
strPath+="\\"+bingstring; DataRow myDataRow = myDataTable.NewRow();
if(File.Exists(strPath))
{ FileStream myFileStream = new FileStream(strPath,FileMode.Open,FileAccess.Read,FileShare.Read);//读图片流
int intlong = (int)myFileStream.Length;
byte[] bingbyte= new Byte[intlong];//变成字节
myFileStream.Read(bingbyte,0,intlong);
myFileStream.Close();
myDataRow[0] = bingbyte;
myDataTable.Rows.Add(myDataRow);
}
}
rptpicture picture = new rptpicture();//图片报表
picture.SetDataSource(myDataTable);//下面是自定义数据源
this.crystalreportview1.reportsource = picture;//显示也可以不显示直接打印
}
else
{
this.Label1.Text = "eewew";
}