簡體   English   中英

C#Printscreen | GDI +中發生了一般錯誤。

[英]C# Printscreen | A generic error occurred in GDI+.

所以我有這個表單,如果用戶按下按鈕,則執行此方法:

//Takes a screenshot of the screen to send it with the email
    private void screenshot()
    {
        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:\Users\*******\Desktop", ImageFormat.Jpeg);
    }

但是當我按下按鈕時,我收到以下錯誤:GDI +中發生了一般錯誤。

有任何想法嗎?

提前致謝。

我打賭它崩潰叫Save ,不是嗎? :)

確保可以寫入該文件! 就像你的情況一樣:我希望你不是試圖將圖像保存為桌面文件夾,因為它看起來像它;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM