Consider the following scenario:
at System.Drawing.Graphics.FromHdcInternal(IntPtr hdc)
at System.Windows.Forms.PaintEventArgs.get_Graphics()
Note The exception indicates that the system is out of memory. However, this is incorrect. The system is actually not out of memory. You can confirm this by using Windows System Resource Manager.
- You create a Microsoft .NET Framework 3.5-based graphics-intensive application on a computer that is running Windows 7 or Windows Server 2008 R2.
- The application uses the graphics device interface (GDI).
- You create a graphics object, and then use it to paint.
Exception type: System.OutOfMemoryException
Message: Out of memory.
When you debug this issue, you receive a stack trace that resembles the following:Message: Out of memory.
at System.Drawing.Graphics.FromHdcInternal(IntPtr hdc)
at System.Windows.Forms.PaintEventArgs.get_Graphics()
Note The exception indicates that the system is out of memory. However, this is incorrect. The system is actually not out of memory. You can confirm this by using Windows System Resource Manager.