namespace WindowsApplication
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
CaptureScreen();
printDialog1.Document = printDocument1;
DialogResult result = printDialog1.ShowDialog();
if (result == DialogResult.OK)
printDocument1.Print();
}
Bitmap memoryimage;
private void CaptureScreen()
{
Graphics mygraphics = this.CreateGraphics(); //
mygraphics.DrawEllipse(Pens.Black, 50, 50, 200, 200); mygraphics.DrawLine(Pens.Black, 150, 140, 140, 170);
mygraphics.DrawArc(Pens.Black, 110, 100, 85, 110, 45, 85);
Size s = this.Size;
memoryimage = new Bitmap(s.Width, s.Height, mygraphics);下面俩句是啥意思?干啥用的》
Graphics g = Graphics.FromImage(memoryimage);
g.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryimage, 0, 0);
}
}
}
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
CaptureScreen();
printDialog1.Document = printDocument1;
DialogResult result = printDialog1.ShowDialog();
if (result == DialogResult.OK)
printDocument1.Print();
}
Bitmap memoryimage;
private void CaptureScreen()
{
Graphics mygraphics = this.CreateGraphics(); //
mygraphics.DrawEllipse(Pens.Black, 50, 50, 200, 200); mygraphics.DrawLine(Pens.Black, 150, 140, 140, 170);
mygraphics.DrawArc(Pens.Black, 110, 100, 85, 110, 45, 85);
Size s = this.Size;
memoryimage = new Bitmap(s.Width, s.Height, mygraphics);下面俩句是啥意思?干啥用的》
Graphics g = Graphics.FromImage(memoryimage);
g.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryimage, 0, 0);
}
}
}
解决方案 »
- 怎么才能控制 table的大小
- 有会用过ef的codefirst吗?如何改变int 主键默认为identity的约定
- ASP.NET 将Button放在Panel上后,Button的事件就无法响应了?
- asp.net聊天室系统 表情功能实现
- excel导入数,身份证号码变成科学计数法了,求解决办法
- 高分求for 句语写法!!
- 奇怪的pagedDataSource
- 新手学ASP.NET,请教一个问题!
- 怎样asp.net在页面中发送消息?
- 网站有病毒。高手救命
- http://blog.csdn.net/litp/archive/2009/06/10/4256203.aspx
- 大家快来帮忙下,Repeater1_ItemDataBound获取值的问题
是一个图形绘制的类,用于绘制图形或图片,它是System.Drawing命名空间下的一个类
定义刷子绘制 memoryimageg.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
屏幕上截图把图形复制到 memoryimage