Click here to Skip to main content
15,843,623 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am facing some issue,

I want to save the BMP

bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                gfxScreenshot = Graphics.FromImage(bmpScreenshot);
                gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

But its giving me an : A generic error occurred in GDI+

tried copying it to a new bitmap and then save , but not working...

Nakul Kundra
Sergey Alexandrovich Kryukov 14-Jun-11 2:34am    
Thread.Sleep makes no sense at all!
Sergey Alexandrovich Kryukov 14-Jun-11 2:35am    
Not enough information. Please, full exception dump, mark code lines where it happens...

1 solution

The posted code is working fine on my system (I removed the useless Thread.Sleep, of course). Please check your application for other issues.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900