DotNet: IDesigner, Context Menus, and Verbs

  • byerkes / 112 / Sun, 05 Apr 2009 11:37:00 GMT / 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:

    idesigner, context, menus, verbs, dotnet, .net

  • http://dotnet.itags.org/dotnet-tech/317760/«« Last Thread - Next Thread »»
  • DotNet Questions

    • Data driven Web Deployment

      Hi,I need to distribute a database driven web application, but:1) How do I configure the Web.Config ...

      By watsonxavier

    • Uploading

      I need to know and am not sure if this is the correct place to ask this question.Does .NET 2.0 handl...

      By jsonterre1

    • Identiy Columns

      Hi, I know how to get table columns with getoledbschematable and how to get the columns and type for...

      By dhernando

    • uploading (post) files with .net webclient/xmlhttp

      is there a way to upload files with the webclient component ?mywebclient.uploadfile ... simple uploa...

      By ron

    • writing a .net exe

      I am new to visual studio.net 2005. What I need to do at my new job is to write an application where...

      By anonymous, 2 Comments

    • Error after installing .net framework SP3

      Hi,I've just ran windows update and got Framework 1.0 Service pack 3. I'm usingVB.Net.Now wh...

      By rud, 3 Comments

    • Uploading

      I developed one component to record voice.(*.wav file).I want to upload that file to web server. Is ...

      By nantha, 4 Comments

    • Question about IIS

      Hi,I have two ASP.NET web projects residing on IIS. (Lets say,http://localhost/Web1 and http://local...

      By diner, 4 Comments

    • Data Driven Web Site

      I want to create a local news data driven web site.Question:Generally, are the html tags within the ...

      By joeburkert, 1 Comments