Option Explicit
Private Sub Command1_Click()
Text1.Enabled = Not Text1.Enabled
If Text1.Enabled Then
Command1.Caption = "关闭"
Else
Command1.Caption = "打开"
End If
End Sub
Private Sub Command2_Click()
Text1.Visible = Not Text1.Visible
If Text1.Enabled Then
Command1.Caption = "隐藏"
Else
Command1.Caption = "显示"
End If
End Sub
Private Sub Command3_Click()
Dim i As Integer
Dim s As Integer
For i = 1 To 10
s = s + i ^ 3
Next
Text1.Text = s
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
MsgBox "在窗体上按下了鼠标左键"
Else
MsgBox "在窗体上按下了鼠标右键"
End If
End Sub
这个还不简单啊!
一。窗体的 MoseDown 事件
if e.button=left then
msgbox("你单击了左键")
else if e.button=right then
msgbox("你单击了右键")
endif
二。
用 CheckBox 代替按钮。
checkOpenOrClose.CheckedChanged
text1.enable=checkopenorclose.checked
if text1.enable=true then
checkopenorclose.text="关闭"
else
checkopenorclose.text="打开"
endif
另一个 Checkbox 按钮的 CheckedChanged 事件类似,把 Enable 属性改成 Visable 属性即可。
三。
btnStartCal.Click
dim Sum as integer
for i as integer = 1 to 10
sum += i ^ 3
next
text1.text = cstr(sum)
已经发道你的QQ邮箱里了