Jump to content

questions about _GUICtrlTreeView_SetTextColor


Recommended Posts

hi guy

is  possible for example set  different color   for item and  for child of item???

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Global Const $COLOR_Turquoise = 0x40e0d0
Global Const $COLOR_Crimson = 0x000000

Example()

Func Example()
    Local $hImage, $idTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

    GUICreate("TreeView Set Text Color", 400, 300)

    $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)


    _GUICtrlTreeView_SetTextColor($idTreeView, $COLOR_Crimson)
    _GUICtrlTreeView_SetLineColor($idTreeView, $COLOR_WHITE)


    _GUICtrlTreeView_BeginUpdate($idTreeView)

        Local $de=_GUICtrlTreeView_Add($idTreeView, 0,"test")
        _GUICtrlTreeView_SetTextColor($idTreeView, 0x00c000)
_GUICtrlTreeView_AddChild($idTreeView,$de,"demade")
    _GUICtrlTreeView_EndUpdate($idTreeView)



    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

thankz at all

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 1 year later...

@faustf I also want to share my solution.

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    Local $hImage, $idTreeView, $de[11]
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

    GUICreate("TreeView Set Text Color", 400, 300)

    $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)

    _GUICtrlTreeView_BeginUpdate($idTreeView)
    For $i = 1 To 10
        $de[$i] = GUICtrlCreateTreeViewItem("TEST: " & $i, $idTreeView)
        If Mod($i, 2) = 0 Then
            GUICtrlSetColor(-1, $COLOR_RED)
        Else
            GUICtrlSetColor(-1, $COLOR_BLUE)
        EndIf
    Next

    For $i = 1 To 5
        $select = Random(1, 10, 1)
        _GUICtrlTreeView_SelectItem($idTreeView, $de[$select]); selecionar item
        $select = _GUICtrlTreeView_GetSelection($idTreeView)
        _GUICtrlTreeView_AddChild($idTreeView, $select, "demade " & $i, -1, -1)
        _GUICtrlTreeView_SetTextColor($idTreeView, $COLOR_lime)
    Next
    _GUICtrlTreeView_EndUpdate($idTreeView)
    _GUICtrlTreeView_Expand($idTreeView)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

 

Edited by Belini
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...