Native component with panel

I want to create my own component, which consists of two other panels. One of them has fixed content (for example, control buttons, etc.), while the other has a standard panel where I can add other components to the constructor (VS2008). I know that I need to create a UserControl where I can place two panels. Then I want to insert my component into the form. But I don’t know how to create behavior when I can add other components (for example, buttons, labels, etc.) only to the second panel in my component. Can someone help me in creating this component?

Thank. Adam.

+3
source share
2 answers

( ):

  [Designer(typeof(NavigationalUserControl.Designer))]
  public partial class NavigationalUserControl : UserControl
  {
    class Designer : ControlDesigner 
    {
      public override void Initialize(IComponent component)
      {
        base.Initialize(component);
        var nc = component as NavigationalUserControl;
        EnableDesignMode(nc.panel2, "ContainerPanel"); 
        EnableDesignMode(nc.bottomPanel, "BottomPanel");
      }
    }

    // rest of normal class
  }
+2

(). UserControl , :

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Panel PanelContent
{
   get { return this.panel2; }
}

leppie

0

Source: https://habr.com/ru/post/1741054/


All Articles