Hi Mark,
There are actually two designers on Component class, one is the
ComponentDesigner which is used in the Form component tray, it provides a
way to customize the design-time behavior of the component when it is on
the form,
Another designer is the an ComponentDocumentDesigner which is an
RootDesigner for the component , it is used to support design of the
component itself.
From your description, I think you are trying to customize the behavior of
the ComponentDocumentDesigner. You may use a customized Root designer for
your component in this way:
[Designer(typeof(MyComponentDocumentDesigner),typeof(IRootDesigner))]
class MyComponentContainerBase : Component {}
//VS.NET will use the Designer on parent class
class MyComponentContainer : MyComponentContainerBase
{}
class MyComponentDocumentDesigner : ComponentDocumentDesigner
{
public override void Initialize(IComponent component)
{
MessageBox.Show("Hello");
base.Initialize (component);
}
}
If the customized root designer is created successfully, you will see a
MessageBox when you switch to the designer view of MyComponentContainer.
There is an article (with sample) describes how to write a simple shape
designer for your component, you may find it in
http://windowsforms.net/articles/shapedesigner.aspx I hope it will be helpful to you.
Note the SubType of file MyShape.cs in "ShapeLibraryTestProject.csproj" is
marked as "code", you might need change it to "Component" to see its
designer view.
Does my answer resolve your problem?
Please feel free to reply this thread if you have further questions on it.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! -
www.microsoft.com/security This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.