自己做一个这样的控件,用listbox和checkbox控件结合使用
解决方案 »
- 自己想买二手书 大家推荐一个地方
- VB调用VC++编写的DLL文件,报"实时错误‘49’DLL调用约定错误,请问是什么 ...
- 如何获得clsid
- 一个Activex怎样调用该页面下的javascript函数?100分在线等
- 一个奇怪的问题,关于isapi,UP者给分
- Open "LPT1" 的奇怪问题啊!!!!大家快帮帮忙啊!
- 请问怎样使commondialog的对话框出现在屏幕正中或屏幕某一位置
- 送分,回答个小问题
- 我写了个歌词播放器,大家下载后评价一下好吗?谢谢了。
- 禁止 ie 控件的菜单
- 请教比较中文字符串大小(上海比北京小)的问题。
- 为什么有时候程序运行的时候会遮住window操作系统的“开始”菜单按钮
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const LB_GETITEMHEIGHT = &H1A1Private Sub Command1_Click()
Msgbox SendMessage(List1.hwnd, LB_GETITEMHEIGHT, 0, 0)
End Function
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongPrivate Type POINTAPI
x As Long
y As Long
End TypePrivate Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypePrivate Sub Form_Load()
Dim i As Long
For i = 1 To 10
List1.AddItem "Item" & i
Next i
End SubPrivate Sub List1_ItemCheck(Item As Integer)
Dim pt As POINTAPI
Dim rc As RECT
GetWindowRect List1.hwnd, rc
GetCursorPos pt
If pt.x > rc.Left + 15 Then
List1.Selected(Item) = Not List1.Selected(Item)
End If
End Sub
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As LongPrivate Type POINTAPI
X As Long
Y As Long
End TypePrivate Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypePrivate bMouseDown As BooleanPrivate Sub Form_Load()
Dim i As Long
For i = 1 To 10
List1.AddItem "Item" & i
Next i
End SubPrivate Sub List1_ItemCheck(Item As Integer)
Dim pt As POINTAPI
Dim rc As RECT
GetWindowRect List1.hwnd, rc
GetCursorPos pt
If (pt.X > rc.Left + 15) And bMouseDown Then
bMouseDown = False
List1.Selected(Item) = Not List1.Selected(Item)
End If
End SubPrivate Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
bMouseDown = True
LockWindowUpdate List1.hwnd
End SubPrivate Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
LockWindowUpdate 0
End Sub