You need to create custom ‘Verbs’ for your Component/Control designer. This will make your ‘verbs’ show up in the property browser and in the designer context menu.
The designer throws an event when the user selects a verb and you can perform custom operation when you handle this event.
You do this by overriding the Verbs property in your Designer class.
Here is an example:
public class MyControlExtDesigner : ControlDesigner
{
...
public override DesignerVerbCollection Verbs
{
get
{
if (this.verbs == null)
{
this.verbs = new DesignerVerbCollection();
this.verbs.Add(new DesignerVerb('Add New Child',new EventHandler(this.OnAdd)));
}
return this.verbs;
}
}
private void OnAdd(object sender, EventArgs eevent)
{
// Code to add a new child inside your control.
...
}
}
Share with