我正在尝试使用此代码。
我在设计时有一个面板和一个按钮。另一个按钮和面板是动态生成的。我得到的结果图像没有显示省略号,但显示按钮,我想知道为什么!?
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);
}
答案 0 :(得分:0)
我最终使用了SendKeys.Send(“{PRTSC}”); 它简单得多。确保在它之前至少休息2秒钟: System.Threading.Thread.Sleep(2000);