如何修改treeview的背景色
来源:互联网 发布:免费彩票网站源码 编辑:程序博客网 时间:2024/05/07 14:04
在通常情况下,treeview的背景色是不可以修改的,我们可以通过API实现,源码如下
Option Explicit
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) 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 Const GWL_STYLE = -16&
Private Const TVM_SETBKCOLOR = 4381&
Private Const TVM_GETBKCOLOR = 4383&
Private Const TVS_HASLINES = 2&
Private Sub Form_Load()
Dim nodex As Node
Dim i As Integer
Dim lStyle As Long
Call SendMessage(TreeView1.hWnd, TVM_SETBKCOLOR, 0, ByVal RGB(255, 0, 0))
lStyle = GetWindowLong(TreeView1.hWnd, GWL_STYLE)
Call SetWindowLong(TreeView1.hWnd, GWL_STYLE, lStyle - TVS_HASLINES)
Call SetWindowLong(TreeView1.hWnd, GWL_STYLE, lStyle)
TreeView1.Style = tvwTreelinesPlusMinusPictureText
TreeView1.BorderStyle = ccFixedSingle
With TreeView1.Nodes
Set nodex = .Add(, , "R", "Root")
nodex.BackColor = RGB(255, 0, 0)
For i = 1 To 10
Set nodex = .Add("R", tvwChild, "C" & i, "Child " & i)
nodex.BackColor = RGB(255, 0, 0)
nodex.EnsureVisible
Next
End With
End Sub
- 如何修改treeview的背景色
- 如何修改treeview的背景色
- 如何修改treeview的背景色
- VB中如何修改treeview的背景色
- 如何修改对话框的背景色
- 改变TreeView控件的背景色
- 如何修改android studio背景色(包括project view的背景色)保护眼睛人人有责
- 如何修改DOJO的dijit.Dialog的背景色
- 我是如何实现UIalertView背景色的修改的
- 修改command的背景色
- RichEdit背景色的修改
- 修改eclipse的背景色
- 修改chrome的背景色
- 修改eclipse的背景色
- 修改eclipse的背景色
- 修改eclipse的背景色
- 修改eclipse的背景色
- 修改eclipse的背景色
- 返回新增加记录的自动增加段的值。
- 公交车上
- Why should you choose fstream classes for file I/O in C++?
- 又有一个Blog
- 如何制作平面式的listview列头
- 如何修改treeview的背景色
- 千篇一律:“外挂”泛滥的网游公关写作
- 实现listview控件report视图下任何列头的双向排序
- 致中国黑客和红客的公开信
- Alternatives to ios::nocreate and ios::noreplace
- CS:SOURCE config.cfg
- ListBox中的字符串超长显示的解决方法
- 处理鼠标移出事件
- FreeXploiT HTML(Hacker Technology Mad Lead)