|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
- Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
- Private Const GWL_STYLE = (-16)
- Private Const WS_MAXIMIZEBOX = &H10000
- Private Const WS_MINIMIZEBOX = &H20000
- Private Const WS_THICKFRAME = &H40000
- Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
- ListView1.SortKey = ColumnHeader.Index - 1 ' 设定排序值的索引,sortkey是从0开始的,所以要减1
- If ListView1.SortOrder = lvwDescending Then ' 当前是否为降序
- ListView1.SortOrder = lvwAscending ' 按升序
- Else
- ListView1.SortOrder = lvwDescending ' 按降序
- End If
- ListView1.Sorted = True ' 激活listview排序
- End Sub
- Private Sub UserForm_Initialize()
- Dim hwnd As Long
- Dim lStyle As Long
- hwnd = FindWindow("ThunderDFrame", Me.Caption) '找到窗口的句柄
- lStyle = GetWindowLong(hwnd, GWL_STYLE) '获得窗口的样式
- lStyle = lStyle Or WS_MINIMIZEBOX '在原窗口样式增加最小化按钮
- lStyle = lStyle Or WS_MAXIMIZEBOX '进一步增加最大化按钮
- lStyle = lStyle Or WS_THICKFRAME '进一步增加窗口边框,使得窗口可以通过鼠标拖拉改变大小
- SetWindowLong hwnd, GWL_STYLE, lStyle '将新的窗口样式指定给窗口
- End Sub
复制代码
|
|