使用VB6,是否可以使用LVS_EX_DOUBLEBUFFER使公共控件ListView无闪烁?此属性在VB.NET中公开,但不在VB6中公开。我将使用版本6的常用控件,所以理论上它应该工作。但是我不知道如何实现它。
答案 0 :(得分:0)
您可以从free VB6 replacement尝试vbAccelerator来查看ListView。它支持LVS_EX_DOUBLEBUFFER
或者use a manifest在VB6中使用Common Controls 6。然后在Form_Load中将LVS_EX_DOUBLEBUFFER
消息发送到ListView。像这样的东西(基于.NET sample)。警告 - air code!
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
Const LVM_FIRST = &H1000
Const LVM_SETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 54)
Const LVM_GETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 55)
Const LVS_EX_DOUBLEBUFFER = &H10000
Const LVS_EX_BORDERSELECT = &H8000
Private Sub FormLoad()
Dim styles As Long
styles = SendMessage(listView.hwnd, _
LVM_GETEXTENDEDLISTVIEWSTYLE, 0, ByVal 0&)
styles = Style Or LVS_EX_DOUBLEBUFFER Or LVS_EX_BORDERSELECT
Call SendMessage(listView.hwnd, _
LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal styles)
End Sub