label也能做出button效果
拉一個label出來放在form上,以下是code
Private Sub Form_Load()
With Label1
.Alignment = 2
.BackColor = RGB(0, 0, 0)
.ForeColor = RGB(255, 255, 255)
.ToolTipText = "我是按鈕"
End With
End Sub
Private Sub Label1_Click()
MsgBox "我是按鈕"
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Label1
.BackColor = RGB(0, 0, 255)
.ForeColor = RGB(255, 255, 128)
.BorderStyle = 1
.Caption = ">>>按我<<<"
End With
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Label1
.BackColor = RGB(0, 0, 0)
.ForeColor = RGB(255, 255, 255)
.BorderStyle = 0
.Caption = "按我"
End With
End Sub