How can I add toolbox controls to myPanel in DesignMode
From: Joeri (Joeri_K_at_newsgroup.nospam)
Date: 09/20/04
- Previous message: Xavier Marion: "Custom collection and CollectionEditor"
- Next in thread: Jeffrey Tan[MSFT]: "RE: How can I add toolbox controls to myPanel in DesignMode"
- Reply: Jeffrey Tan[MSFT]: "RE: How can I add toolbox controls to myPanel in DesignMode"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 20 Sep 2004 18:04:44 +0200
Hi,
I am trying to write a designer for control derived from
System.Windows.Forms.Panel.
I hooked up a handler for IComponentChangeService.ComponentAdded event
OnComponentAdded ( object sender, ComponentEventArgs e )
where I try to add contols (e.g., Button), dragged from toolbox onto
myControl, to Contols collection of myContol
myPanel designedControl = (myPanel) this.Control;
Control addedContol = (System.Windows.Forms.Control) e.Component;
designedControl.Controls.Add( addedContol );
And if I later check the Controls collection, newly added Button appears
there, but that does not affect button's behavior. When I drag away myPanel,
button remains where it was dropped.
(When I checked the Bounds property of the button, top left corner was at
0,0 , what I found a bit strange since the button was not at this location
on the form or myControl.)
Can someone please point out to me what I'm doing wrong (or not doing
properly).
Thanks in advance.
- Previous message: Xavier Marion: "Custom collection and CollectionEditor"
- Next in thread: Jeffrey Tan[MSFT]: "RE: How can I add toolbox controls to myPanel in DesignMode"
- Reply: Jeffrey Tan[MSFT]: "RE: How can I add toolbox controls to myPanel in DesignMode"
- Messages sorted by: [ date ] [ thread ]