您的位置首页  文化

treeview控件 TreeView1

PrivateDeclareFunctionGetWindowLongLib"User32"Alias"GetWindowLongA"(ByValhWndAsLong,ByValnIndexAsLong)AsLongPrivateDeclareFunctionSetWindowLongLib"Use

Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Const GWL_STYLE = -16&Private Const TVM_SETBKCOLOR = 4381&Private Const TVM_GETBKCOLOR = 4383&Private Const TVS_HASLINES = 2&Dim frmlastForm As FormPrivate Sub Form_Load()Dim nodX As NodeSet nodX = TreeView1.Nodes.Add(, , "R", "Root")Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C1", "Child 1")Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C2", "Child 2")Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C3", "Child 3")Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C4", "Child 4")nodX.EnsureVisibleTreeView1.style = tvwTreelinesText ' Style 4.TreeView1.BorderStyle = vbFixedSingleEnd SubPrivate Sub Command1_Click()Dim lngStyle As LongCall SendMessage(TreeView1.hWnd, TVM_SETBKCOLOR, 0, ByVal RGB(255, 0, 0))'改变背景到红色lngStyle = GetWindowLong(TreeView1.hWnd, GWL_STYLE)Call SetWindowLong(TreeView1.hWnd, GWL_STYLE, lngStyle - TVS_HASLINES)Call SetWindowLong(TreeView1.hWnd, GWL_STYLE, lngStyle)End Sub廖国娟2021-03-28 05:40:18属性里面改

免责声明:本站所有信息均搜集自互联网,并不代表本站观点,本站不对其真实合法性负责。如有信息侵犯了您的权益,请告知,本站将立刻处理。
网站推荐更多>>