Home » Category » DotNet

DotNet: IDesigner, Context Menus, and Verbs

112| Sun, 11 Nov 2007 06:17:00 GMT| byerkes| Comments (0)
I am trying to create a custom form designer, I am using the following code which works fine.

DesignSurface surface = new DesignSurface(typeof(UserControl));
ServiceContainer sc = new ServiceContainer(surface);
Control c = surface.View as Control;
c.Click += new EventHandler(c_Click);

if (c != null)
{
c.Dock = DockStyle.Fill;
this.tabPage1.Controls.Add(c);
}

Control designer = surface.ComponentContainer.Components[0] as Control;
designer.Dock = DockStyle.Fill;
designer.BackColor = System.Drawing.Color.Transparent;
IDesignerHost host = (IDesignerHost)sc.GetService(typeof(IDesignerHost));


The problem comes I am trying to create verbs which I assume are context menu options. I have a custom control that inherits the textbox, which even though I add verbs does not work in runtime.

IDesigner oIDesigner = host.GetDesigner(oControl);
oIDesigner.Verbs.Add(new DesignerVerb("Click", new EventHandler(OnClick)));

The OnClick never fires on click nor does it show in a context menu. I can see the control and move it around.

Thanks

Keywords & Tags: idesigner, context, menus, verbs, dotnet, .net

URL: http://dotnet.itags.org/dotnet-tech/317760/
 
«« Prev - Next »» 0 helpful answers below.

DotNet Hot Answers

DotNet New questions

DotNet Related Categories