Disable desginers for sited child controls (VS.NET 2005)
- From: "ytui@xxxxxxxxxxx" <ytui@xxxxxxxxxxx>
- Date: 5 Aug 2005 06:46:00 -0700
I have a Custom control (ButtonBar) which should contain a collection
of Button controls. I want to have the buttons in the collection sited
in order to get events and code-gen for them but I do not want the
buttons to be designable on their own in the forms designer. My current
implementation has a collection editor that the user can use to add
buttons. The problem is that since the collection editor uses
IDesignerHost.CreateComponent() the buttons get sited and thus are
available to the user in the Form designer. The user can move around
the buttons and even move them outside the control. I could override
CollectionEditor.CreateInstance() and make the buttons non-sited but
then I don't get events and code-gen.
ButtonBar should also be able to handle several diffrent button
controls that derive from Button and since these controls should also
be usable outside ButtonBar I cannot implement a designer for each
button type. I guess what I'm looking for is some way to make sited
child controls in a parent control non-designable using only the parent
controls desinger?
I've been looking at BehaviorService but I don't really know how to use
it for this purpose. Somehow if I can use it to make the child control
non-selectable maybe that could solve it?
There is also the problem of location of the child controls. I want
them to be placed by the parent control no matter what their own
location property says. Putting code in OnControlAdded() is useless for
this since code in InitializeComponent() may add them first and then
set their location.
Please help! Anyone?
.
- Prev by Date: UserControl on inherited form
- Next by Date: Why no see Property Builder on grid
- Previous by thread: UserControl on inherited form
- Next by thread: Why no see Property Builder on grid
- Index(es):