Custom control borders/WM_NCPAINT

J

Jim Margarit

I have create a Panel subclass that I can resize at runtime. I want to
draw resizing handles that accurately track the panel frame.
So far I have tried drawing them in the wm_sizing handler, the wm_paint
handler and the overriden OnPaint event and cannot get an accurate
rectangle to use to paint the handles. The handles sort of follow the
border but not exactly. It seems that it might work to do it at the same
time the border is drawn with the WM_NCPAINT but I don't know how to get
the frame rectangle from the hrgn. Anyone able to point me in the right
direction?

Jim Margarit
 
B

Bob Powell [MVP]

You're going about it the wrong way. It's not the frame that should size the
handles but the handles that should resize the frame. It needs to be a
seperate control using reflection or a specialized window that sits on top
of the object you're resizing.

If you're interested in a commercial solution check out the RectTracker on
XRay Tools.

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

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

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

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

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