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 / Design Time / October 2004

Tip: Looking for answers? Try searching our database.

Need an event for when the user drags a component on

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marina - 11 Oct 2004 20:09 GMT
Hi,

I need an event that fires ONLY when the user has JUST dragged a component
on.
I tried creating my own ComponentDesigner class to deal with some events.

I tried handling the ComponentAdded event.  ComponentAdded fires whenever
the project is loaded and the form designer is loaded.

The ComponentAdding event does not run unless at least 1 of the object is
already on the form.  And it always runs for all the previous instances of
the object - not for the current one (Initialize method is called after
ComponentAdding is called).

Basically, if the object just got added to the form (i.e. user just dragged
it on), I want to create another object to go along with it.

Alternatively, I could deal with checking if a particular property is set to
perform this action. Problem is, that ComponentAdded is run before the
property sets from the previous design session are run - so the property is
never set at the time this event runs.

Any solutions?
Marina - 11 Oct 2004 20:46 GMT
Found that if I get the IDesignerHost service, I could check its Loading
property to see if the designer was loading.  If it is not, then I know the
control was just added.  If it is, then I know the designer is just loading,
so no need to do anything.

> Hi,
>
[quoted text clipped - 19 lines]
>
> Any solutions?
Joey Callisay - 12 Oct 2004 02:32 GMT
I can sense that you are creating a custom container control, aren't you?
If you are, then there is a CanParent method to validate the controls added
to your container control...

here is another good link on designers:
http://www.divil.co.uk/net/articles/designers/collectioncontrols.asp

> Found that if I get the IDesignerHost service, I could check its Loading
> property to see if the designer was loading.  If it is not, then I know the
[quoted text clipped - 27 lines]
> >
> > Any solutions?
Marina - 15 Oct 2004 15:59 GMT
No, I actually wasn't. I don't think CanParent has anything to do with what
information I needed.  The Loading property does the trick though.

> I can sense that you are creating a custom container control, aren't you?
> If you are, then there is a CanParent method to validate the controls added
[quoted text clipped - 42 lines]
> > >
> > > Any solutions?

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.