1
的底部加入倍增我將控件添加到形式這樣添加控制以形成但間隙保持當在先前的控制
Dim sharpUserX As New SharpUser()
Dim y As Integer = 0
For Each con As Control In PnlSharpUsers.Controls
If TypeOf(con) is SharpUser then ' as i have the pnaddbtn, which i move to the bottom below
If y < con.Bottom Then y = con.Bottom
End If
Next
sharpUserX.Location = New Point(2, y)
'sharpUserX.Location = pnlAddBtn.location 'this does that exact same
sharpUserX.Size = sharpUserSize
PnlSharpUsers.Controls.Add(sharpUserX)
'put add button back on
pnlAddBtn.Location = New Point(pnlAddBtn.Left, sharpUserX.Bottom) 'strangely this is always correct
這被稱爲上的按鈕按壓,這增加了一個ShrpUser控制到我的面板,然後將addbtn面板移動到底部。
添加btn面板正確移動,但添加的新控件被添加,但位置似乎是從它到前一個控件的差距的兩倍。
赫雷什位置如果每個i之後輸出它們添加2
1 added
loc={X=2,Y=0} size={Width=849, Height=117}
2nd added
loc={X=2,Y=0} size={Width=849, Height=117}
loc={X=2,Y=135} size={Width=849, Height=117}
3rd added
loc={X=2,Y=0} size={Width=849, Height=117}
loc={X=2,Y=135} size={Width=849, Height=117}
loc={X=2,Y=291} size={Width=849, Height=117}
ý應該是117和y 3應該是234 形式由字體確實規模。我認爲這是什麼導致它,但我不知道該怎麼做,並不能理解爲什麼pnladdBtn的作品。
第一個片段出錯了,因爲它沒有通過面板的AutoScrollPosition屬性調整位置。 –