111,131
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);
this.pictureBox1.Refresh();
}
void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.DrawEllipse(new Pen(Brushes.Blue),new Rectangle(new Point(5,5),new Size(40,40)));
}
private void button2_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
PrintPreviewDialog ppd = new PrintPreviewDialog(); //阅览窗体
ppd.Document = pd;
pd.Print();
}
void pd_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
g.DrawEllipse(new Pen(Brushes.Blue), new Rectangle(new Point(5, 5), new Size(40, 40)));
}