我正在创建一个PanelControl,我正在添加一个简单的填充。但似乎它没有用。
请问如何填充?
这是我的代码
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Panel As New DevExpress.XtraEditors.PanelControl
Dim Button As New DevExpress.XtraEditors.SimpleButton
Panel.Padding = New Padding(15)
Panel.Parent = Me
Button.Parent = Panel
End Sub
运行此代码时,面板内创建的按钮与面板没有任何预期的空间。
由于
答案 0 :(得分:0)
很可能因为面板中的项目是在设置填充之前创建的。面板中项目的位置由面板的属性确定。尝试在创建元素之前设置填充。
答案 1 :(得分:0)
添加此额外行可能对您有所帮助。
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Panel As New DevExpress.XtraEditors.PanelControl
Dim Button As New DevExpress.XtraEditors.SimpleButton
Panel.AutoSize = True 'Adding this line should solve your problem
Panel.Padding = New Padding(15)
Panel.Parent = Me
Button.Parent = Panel
End Sub
如果对任何人都有效,请告诉我。