山西黑石材价格:初学VB,寻求注释,请把?处写上注释,谢谢

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/02 19:02:17
Private item_height As Single ??此变量的作用
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd _
As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_GETITEMHEIGHT = &H1A1 ??

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
If Not (Source Is List1) Then Exit _
Sub
If List1.ListIndex >= 0 Then
List1.RemoveItem List1.ListIndex
End If

End Sub

Private Sub Form_Load()
List1.AddItem "picture"
List1.AddItem "list"
List1.AddItem "today"
List1.AddItem "cat"
item_height = Screen.TwipsPerPixelY * SendMessage(List1.hwnd, LB_GETITEMHEIGHT, 0, vbNullString) ??
End Sub

Private Sub List1_DragDrop(Source As Control, X As Single, Y As Single)
Dim new_pos As Integer
If Not (Source Is List1) Then Exit Sub
new_pos = Y / item_height ??
If new_pos > List1.ListCount Then
Else
List1.AddItem List1.List(List1.ListIndex), new_pos
End If
If List1.ListIndex >= 0 Then List1.RemoveItem List1.ListIndex??

End Sub

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.Drag
End Sub

Private item_height As Single
'Private,表示这声明只限于这个子过程(如果写在过程/函数内),如果写在函数外,则表示这声明只限于本模块

Private item_height As Single
'等同于 Dim item_height as single,声明变量item_height为单精度类型

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd _
As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const LB_GETITEMHEIGHT = &H1A1
'声明常量,常量值为&H1A1(16制制数,等于十进制数417)

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
If Not (Source Is List1) Then Exit _
Sub
If List1.ListIndex >= 0 Then
List1.RemoveItem List1.ListIndex
End If

End Sub

Private Sub Form_Load()
List1.AddItem "picture"
List1.AddItem "list"
List1.AddItem "today"
List1.AddItem "cat"
item_height = Screen.TwipsPerPixelY * SendMessage(List1.hwnd, LB_GETITEMHEIGHT, 0, vbNullString)
'Screen.Twipsperpixely 取得屏幕提尔(till)与像素点的比例
'具体这是什么用的语句,自已调试,研究下吧,我没仔细看程序
End Sub

Private Sub List1_DragDrop(Source As Control, X As Single, Y As Single)
Dim new_pos As Integer
If Not (Source Is List1) Then Exit Sub

new_pos = Y / item_height
'这里y的值的单位是Till,不是像素,此句应该是算出鼠标的位置的

If new_pos > List1.ListCount Then
Else
List1.AddItem List1.List(List1.ListIndex), new_pos
End If
If List1.ListIndex >= 0 Then List1.RemoveItem List1.ListIndex '清除Item控件内的指定列表

End Sub

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.Drag
End Sub

晕倒。。。初学者的生育这么复杂。。。。呵呵