Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / February 2005

Tip: Looking for answers? Try searching our database.

add border and resizing handles to control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keith - 10 Feb 2005 22:01 GMT
Hi,

I am creating an application which contains controls which can be moved
and resized.  I would like to know the best way to add a border and
resizing handles to a control, the same way that the .Net IDE adds
borders and handles to controls when you click on them.  So far the
only way I can think to accomplish this is to override OnPaint and draw
a rectangle, and then use tiny label controls for the handles.  This is
somewhat ugly to implement.

Any suggestions?

*----*----*
|         |
*         *
|         |
*----*----*

thanks,
Keith
Bob Powell [MVP] - 11 Feb 2005 01:15 GMT
Well, putting my flameproof trousers on....

I sell a tool that does this exact thing.

You can find out my e-mail address by removing the spamkiller stuff.

Signature

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.

> Hi,
>
[quoted text clipped - 16 lines]
> thanks,
> Keith
Keith - 15 Feb 2005 04:13 GMT
Bob,

Thanks, but I'm trying to do this without third party tools (otherwise
I haven't learned anything!)

I've implemented some tedious math and used DrawSelectionFrame and
DrawGrabHandle as well as handling OnPaint, MouseMove, MouseDown, and
MouseUp.  Does this sound like the right way to do it?

Right now I have everything on a single form, but I guess I could
create a separate control.  I assume that it would have to be separate
from the control that it encapsulates, since it will be outside of the
control's client rectangle.  So far I've managed to handle translation
and resizing of one control.  Now I need to handle multiple controls.

Keith

> Well, putting my flameproof trousers on....
>
[quoted text clipped - 35 lines]
> > thanks,
> > Keith
Keith - 16 Feb 2005 03:10 GMT
Bob,

Perhaps you can answer this question.  I would like to encapsulate my
sizing frame in a control, but I do not want it to be a parent of the
control that sits inside it.  I want to handle mouse events on the
frame itself, but anything that sits inside the frame should be handled
separately and is not a child of the frame.  I also don't want to make
the form a panel - that is, the control that sits inside the frame
should have coordinates relative to the parent form, not the sizing
frame.

Any thoughts?
Keith

> Well, putting my flameproof trousers on....
>
[quoted text clipped - 35 lines]
> > thanks,
> > Keith

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.