0

私はこのコードを試しています。

設計時にパネルとボタンがあります。別のボタンとパネルが動的に生成されています。結果の画像には省略記号が表示されていませんが、ボタンが表示されています。その理由を知りたい!?

    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);
    }
4

1 に答える 1

0

最終的に SendKeys.Send("{PRTSC}"); を使用しました。それははるかに簡単です。System.Threading.Thread.Sleep(2000); の前に少なくとも 2 秒のスリープを入れてください。

于 2013-07-25T12:58:33.773 に答える