我正在试验这段代码。
我在设计时有一个面板和一个按钮。另一个按钮和面板正在动态生成。我得到的结果图像不是显示省略号,而是显示按钮,我想知道为什么!?
private void Form3_Load(object sender, EventArgs e)
{
}
private void Form3_Paint(object sender, PaintEventArgs e)
{
Graphics g = this.CreateGraphics();
Pen pen = new Pen(Color.Black, 2);
Brush brush = new SolidBrush(Color.White);
Rectangle rect = new Rectangle(50, 50, 100, 200);
Ellipse el = new Ellipse();
el.Rectangle = rect;
//g.DrawRectangle(pen, rect);
g.DrawEllipse(pen, rect);
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(printscreen as Image);
graphics.CopyFromScreen(0, 0, 0, 0, printscreen.Size);
printscreen.Save(@"C:\Temp\temp.jpg", ImageFormat.Jpeg);
}