现有两张不同名字的图片,我想在页面上实现打印功能,把这两张图片在同一页面打印出来,我用的是C# Winform,请问该如何实现?我现有打印一张图片的代码,如下:
private void PrintPageImage(object sender, PrintPageEventArgs ev)
{
//定义输出图处的相关大小
Image image = this.pic.Image;
int x=ev.MarginBounds.X;
int y=ev.MarginBounds.Y;
int width=image.Width;
int height=image.Height;
System.Drawing.Rectangle destRect=new System.Drawing.Rectangle(x,y,width,height);
ev.Graphics.DrawImage(image,destRect,0,0,image.Width,image.Height,System.Drawing.GraphicsUnit.Pixel);
}
private void PrintPageImage(object sender, PrintPageEventArgs ev)
{
//定义输出图处的相关大小
Image image = this.pic.Image;
int x=ev.MarginBounds.X;
int y=ev.MarginBounds.Y;
int width=image.Width;
int height=image.Height;
System.Drawing.Rectangle destRect=new System.Drawing.Rectangle(x,y,width,height);
ev.Graphics.DrawImage(image,destRect,0,0,image.Width,image.Height,System.Drawing.GraphicsUnit.Pixel);
}
解决方案 »
- XP操作系统32位机C#2005环境下开发的应用程序如何在WIN7 64位机器上运行?
- 把16进制的字符串保存在数组中,求代码。
- 学C#数学不好是否有很大的影响?
- 如何用c#程序实现远程抓取屏幕
- 异步调用问题
- KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam)后面3个参数是什么意思?
- WINFORM中dateTimePicker控件
- 为什么struct的实例,不能用==或者!=来做比较?
- 怎么判断一组数据是否服从正态分布啊?
- 有关数据库字段和窗体控件
- 用什么命令可以实现在c#程序中执行其他的程序,或者执行dos下的命令
- [STAThread]、[MTAThread]是何意思?
{
//定义输出图处的相关大小
Image image = this.pic.Image;
int x=ev.MarginBounds.X;
int y=ev.MarginBounds.Y;
int width=image.Width;
int height=image.Height;
System.Drawing.Rectangle destRect=new System.Drawing.Rectangle(x,y,width,height);
ev.Graphics.DrawImage(image,destRect,0,0,image.Width,image.Height,System.Drawing.GraphicsUnit.Pixel);//Draw another image
Image image2 = Image.FromFile( otherfile );//you can change its source
x=ev.MarginBounds.X;
y=ev.MarginBounds.Y;
width=image2.Width;
height=image2.Height;destRect=new System.Drawing.Rectangle(x,y + image.Height + 10,width,height);
ev.Graphics.DrawImage( image2,destRect,0,0,image2.Width,image2.Height,System.Drawing.GraphicsUnit.Pixel);}