æ以ä¸æ¥éª¤å®ç°å¨ææ·»å å½ä»¤æé®
ï¼1ï¼æ°å»ºä¸ä¸ªVB6å·¥ç¨
ï¼2ï¼Form1çªä½ä»£ç
Option Explicit
'å®ä¹è¦å¨ææ·»å çå½ä»¤æé®åéï¼å¸¦äºä»¶å¤çï¼
Dim WithEvents cmdX As CommandButton
'ç¹å»å¨ææ·»å çæé®ï¼å¼¹åºå¯¹è¯æ¡
Private Sub cmdX_Click()
MsgBox "å¨ææ·»å çå½ä»¤æé®ï¼ï¼ï¼"
End Sub
'é¼ æ åå»çªä½ï¼å¨ææ·»å ä¸ä¸ªå½ä»¤æé®
Private Sub Form_DblClick()
If cmdX Is Nothing Then
Set cmdX = Controls.Add("VB.CommandButton", "cmd1")
cmdX.Caption = "ç¹å»æå"
cmdX.Width = 4500
cmdX.Move 150, 150
cmdX.Visible = True
End If
End Sub
温馨提示:内容为网友见解,仅供参考