如何打印图片,数据库中存放的是图片的路径.

haoco 2003-09-23 11:24:22
如何打印图片,数据库中存放的是图片的路径.

大家帮帮忙!
...全文
91 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhehui 2003-09-24
  • 打赏
  • 举报
回复
首先把图片读到pictureBox1中。
这个不难吧。
zhehui 2003-09-24
  • 打赏
  • 举报
回复
//打印事件。
private void button5_Click(object sender, System.EventArgs e)
{
try
{
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument(); //Assumes the default printer
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);//调用打印事件.
pd.Print();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{

}

}
///////////////////////
//执行打印
private void pd_PrintPage(object sender,PrintPageEventArgs ev)
{

Rectangle rect = new Rectangle(new Point((int)leftMargin + 450,(int)30),
new Size((int)pictureBox1.Image.Size.Width,(int)pictureBox1.Image.Size.Height));
ev.Graphics.DrawImage(pictureBox1.Image,rect);

ev.HasMorePages = false ;
}
///////////////////////////
这里主要是以画图的方式进行打印。
feilong215 2003-09-24
  • 打赏
  • 举报
回复
學習,拿分
angelior 2003-09-24
  • 打赏
  • 举报
回复
string strPath = 字段值
Image ima=Bitmap.FromFile(strPath );
pictureBox.Image = ima;
ArLi2003 2003-09-24
  • 打赏
  • 举报
回复
<body onload="windows.print()">
<img src="<%=RS("IMGPATH")%>">
</body>
isleepy 2003-09-24
  • 打赏
  • 举报
回复
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemDrawingPrintingPrintDocumentClassPrintTopic.htm
先看这个,
然后把
ev.Graphics.DrawString
改成
ev.Graphics.DrawImage()
Image可以用FromFile(图片的路径)取到
FromFile函数。。。 -_-!!! 寒
楼上的。。。我的问题研究出来了么?
jackyhzzjcn 2003-09-24
  • 打赏
  • 举报
回复
取出文件名,读出图片,打印!
大户翁 2003-09-23
  • 打赏
  • 举报
回复
通过 数据库中存放的是图片的路径 得到 图片全名
再传入Web 浏览器 打开 -----》打印。

参考!

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧