1
我需要動態地克隆面板控制,以相同的形式是生成現有面板的同一面板下的副本,我的形式如何在vb.net
我已經寫了一些代碼,會做我想要的工作但它不會根據我的需要工作,但它會破壞主面板並生成副本,但我不想銷燬第一塊,我想保留所有面板...
這是我在按鈕「+」點擊事件時調用的函數
Friend Function AddNewPanel() As System.Windows.Forms.Panel
Dim Pnl As New System.Windows.Forms.Panel
Pnl = MediPanel 'This is the main panel that I want to copy
Pnl.Top = 500
'Pnl.Left = 100
ParentPanel.Controls.Add(Pnl) 'ParentPanel in which I want to generate a copy
Return Pnl
End Function
This is what I exactly want但是This is actually happened
所以,我要生成面板的副本,我按下「+」按鈕,也更早板不應該被銷燬..