How to add the same control into multi panel in C#?

前端 未结 3 581
自闭症患者
自闭症患者 2021-01-18 14:49

I have a button called button1 and two panels called: panelA and panelB (visible is false by default) and the following code (WinForms):

panelA.Controls.Add(         


        
3条回答
  •  星月不相逢
    2021-01-18 15:28

    Only One Instance of anobject can be shown , So you have to create another Instance foryour button. Both of them will act the same ( because they are One Control - but will have different acts in order to have different instance ).

    And this is because you only can have One instance of a control. you really do not need same instance of an object.

提交回复
热议问题