OwnerDraw == Out of Memory Exception

  • Thread starter Thread starter AKM
  • Start date Start date
A

AKM

Hello:

I'm trying to create my own Windows Forms menus via the
MainMenu control by setting the OwnerDraw property to true
for the various menu items. Right now I just have one item
and am using the exact code from MSDN (ms-
help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindow
sformsmenuitemclassdrawitemtopic.htm).

As soon as I click on the top-level menu item (under which
are the ownerdraw items) the app throws an Out Of Memory
Exception. I have tried various code snippets that are
available on the web (specifically because I want to add
icons to the menus) and they all throw the same exception.
I have loads of memory on my machine.

What's going on?

Thanks,
AKM
 
-----Original Message-----
Are you trying to draw some bitmaps by creating a bitmap brush by any chance?

.

Yes. It works initially. Then when I run the code again, I
start getting out of memory exceptions. The brushes are
being disposed though.
 
Back
Top