How to add user control to panel

后端 未结 3 2084
猫巷女王i
猫巷女王i 2021-02-20 04:38

I have created multiple user controls in my project and what I need to do is to be able to switch between them on a panel control.

for example, if the user click button1

3条回答
  •  生来不讨喜
    2021-02-20 04:55

    You have to instantiate your controls. You will have to make sure the size is set appropriately, or for it to have an appropriate dockfill.

    var myControl = new MyProject.Modules.Masters();
    panel1.Controls.Add(myControl);
    

提交回复
热议问题