VB中怎样将命令按钮定位在窗体中央

来源:百度知道 编辑:UC知道 时间:2024/04/28 10:25:59

Private Sub Form_Load()
Command1.Top = (ScaleHeight - Command1.Height) / 2
Command1.Left = (ScaleWidth - Command1.Width) / 2
End Sub

Private Sub Form_Resize()
Form_Load
End Sub

希望能帮助你

直接在Resize编写就可以
Private Sub Form_Private Sub Form_Resize()
Command1.Top = (ScaleHeight - Command1.Height) / 2
Command1.Left = (ScaleWidth - Command1.Width) / 2
End Sub

Private Sub Form_Load()
Command1.Top = (ScaleHeight - Command1.Height) / 2
Command1.Left = (ScaleWidth - Command1.Width) / 2
End Sub

Private Sub Form_Resize()
Form_Load。

Private Sub Form_Load()
Command1.Left = (Form1.ScaleWidth - Command1.Width) \ 2
Command1.Top = (Form1.ScaleHeight - Command1.Height) \ 2
End Sub

for i=1to3