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 General / July 2006

Tip: Looking for answers? Try searching our database.

Design time Drag and Drop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Solitude - 11 Jul 2006 03:02 GMT
Hi,

we have this custom control we have designed. We want to allow the user in
VS .NET 2005 environment to drag another control onto our control at design
time and receive information of what type of control was dragged onto it. Any
help would be great. Thanks,
Matt
Stoitcho Goutsev (100) - 11 Jul 2006 13:59 GMT
Solitude,

You need to create a designer for this control and attach it to the control
using the DesignerAttribute.

Make the designer to derive from ParentControlDesigner or
ScrollableControlDesigner (if your control supports scroll bars). In the
designer you can override CanParent virtutal method and check whether the
control can parent the type of the control that is about to be dropped. I
believe this is what you wanted.

Signature

HTH
Stoitcho Goutsev (100)

> Hi,
>
[quoted text clipped - 5 lines]
> help would be great. Thanks,
> Matt
Solitude - 16 Jul 2006 21:08 GMT
Thanks,
that worked great, except that works for Drag and Drop.
But they can select the control in the toolbox without dragging it and click
on my control, this does not fire off the OnDragDrop or the CanParent events.
So how I can I prevent them from adding a control to my control using this
DesignerAttribute method. Thanks,

Solitude

> Solitude,
>
[quoted text clipped - 16 lines]
> > help would be great. Thanks,
> > Matt
Dave Sexton - 11 Jul 2006 14:07 GMT
Hi Solitude,

A design-time group would be a more appropriate place to ask your question,
but I do have some advice.  Derive your control from Panel and you'll get
container designer support for free.  To peek at controls that are added to
your control in the designer you can override the ControlAdded method.  In
ControlAdded throw an Exception if a Control's Type is not valid as a child
of your Control.

HTH

> Hi,
>
[quoted text clipped - 5 lines]
> help would be great. Thanks,
> Matt

Rate this thread:







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.