custom GDI+ component and OnPain

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
 
B

Bob Powell [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top