custom GDI+ component and OnPain

  • Thread starter Thread starter David Sobey
  • Start date Start date
D

David Sobey

Hi

I'm making a custom component using GDI+, a calendar grid thingy. I paint
the grid and numbers in my overrided OnPaint. However, when i go to paint
other things at other times in other functions, like cute little rectangles
or fancy text, it calls OnPaint and I'm fairly sure it's painting over what
i just painted 3 nanoseconds ago, coz nothing is appearing. Good way around
this prob?

cheers
dave
 
Never paint in anything EXCEPT the OnPaint call. I suspect you're doing
something clever like painting in a click-event or timer by using the
CreateGraphics call.

See the GDI+ FAQ most asked question for why this is going to be a paintful
experience for you.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
Back
Top