一、VB事件过程
Private Sub 对象_事件()
语句
End Sub
Private Sub Command1_Click()
Picture1.Left = Picture1.Left - 100
End Sub
Sub 过程 Private 私有
对象:窗体、标签、文本框、图片框、按钮……
事件:单击、双击、按键……
属性:Top、Left、Width、Height……
1twip(缇)一磅的 1/20 ,或者是一英寸的 1/1440。
二、If语句格式
If 条件 then
语句1
Else
语句2
End if
If a>b then
Max=a
Else
Max=b
End if
三、设计方向键控制图片移动程序。
提示:图片框的KeyDown事件,方向键左、上、右、下的KeyCode分别为:37、38、39、40。
Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then
Picture1.Left = Picture1.Left - 100
End If
End Sub