Jump to content

Recommended Posts

Posted (edited)

Hello everyone. I want to change the color of the group titles in my list but I couldn't succeed. Can you help me? The blue color is not visible in a dark list, so I want to change it.

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>

; GUI oluştur
Local $hGUI = GUICreate("ListView Grup Rengi Örneği", 400, 300)
Local $idListView = GUICtrlCreateListView("Kolon 1|Kolon 2", 10, 10, 380, 280)
Local $hListView = GUICtrlGetHandle($idListView)

; ListView gruplarını etkinleştir
_GUICtrlListView_EnableGroupView($hListView, True)

; Grup 1 oluştur
Local $iGroup1 = _GUICtrlListView_InsertGroup($hListView, -1, 0, "Grup 1", 1)
; Grup 2 oluştur
Local $iGroup2 = _GUICtrlListView_InsertGroup($hListView, -1, 1, "Grup 2", 1)

; ListView'e öğeler ekle
Local $idItem1 = GUICtrlCreateListViewItem("Öğe 1|Değer 1", $idListView)
Local $idItem2 = GUICtrlCreateListViewItem("Öğe 2|Değer 2", $idListView)
Local $idItem3 = GUICtrlCreateListViewItem("Öğe 3|Değer 3", $idListView)

; Öğeleri gruplara ata
_GUICtrlListView_SetItemGroupID($hListView, 0, $iGroup1) ; Öğe 1, Grup 1'e atanır
_GUICtrlListView_SetItemGroupID($hListView, 1, $iGroup1) ; Öğe 2, Grup 1'e atanır
_GUICtrlListView_SetItemGroupID($hListView, 2, $iGroup2) ; Öğe 3, Grup 2'e atanır

; Grup başlığı rengini değiştir
_SetGroupColor($hListView, $iGroup1, 0xFF0000) ; Kırmızı renk (RGB: 255, 0, 0)
_SetGroupColor($hListView, $iGroup2, 0x00FF00) ; Yeşil renk (RGB: 0, 255, 0)

; GUI'yi göster
GUISetState(@SW_SHOW)

; Mesaj döngüsü
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

GUIDelete()

; Grup başlığı rengini değiştiren fonksiyon
Func _SetGroupColor($hListView, $iGroupID, $iColor)
    ; LVGROUP yapısı
    Local $tGroup = DllStructCreate("uint;uint;uint;ptr;int;wchar[256];int;int;uint;uint;uint")
    DllStructSetData($tGroup, 1, DllStructGetSize($tGroup)) ; cbSize
    DllStructSetData($tGroup, 2, 0x10) ; mask (LVGF_STATE ve LVGF_HEADER)
    DllStructSetData($tGroup, 3, $iGroupID) ; iGroupId
    DllStructSetData($tGroup, 10, $iColor) ; crHeader (arka plan rengi)

    ; LVM_SETGROUPINFO mesajı gönder
    Local $aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hListView, "uint", 0x109D, "wparam", $iGroupID, "struct*", $tGroup)
    If @error Then Return False
    Return True
EndFunc

 

Edited by ufukkreis853
  • ufukkreis853 changed the title to List View Group Color (HELP)
Posted (edited)

Unfortunately, you can't.  It was possible back then on XP, but since it has been removed :

Spoiler

crLeft

Type: COLORREF

Specifies the color of the left border. Not implemented.

crTop

Type: COLORREF

Specifies the color of the top border. Not implemented.

crRight

Type: COLORREF

Specifies the color of the right border. Not implemented.

crBottom

Type: COLORREF

Specifies the color of the bottom border. Not implemented.

crHeader

Type: COLORREF

Specifies the color of the header text. Not implemented.

crFooter

Type: COLORREF

Specifies the color of the footer text. Not implemented.

ps. when posting code, please use english for comment, name, description, titles, etc.

Edited by Nine
Posted
1 hour ago, Nine said:

Unfortunately, you can't.  It was possible back then on XP, but since it has been removed :

  Reveal hidden contents

crLeft

Type: COLORREF

Specifies the color of the left border. Not implemented.

crTop

Type: COLORREF

Specifies the color of the top border. Not implemented.

crRight

Type: COLORREF

Specifies the color of the right border. Not implemented.

crBottom

Type: COLORREF

Specifies the color of the bottom border. Not implemented.

crHeader

Type: COLORREF

Specifies the color of the header text. Not implemented.

crFooter

Type: COLORREF

Specifies the color of the footer text. Not implemented.

ps. when posting code, please use english for comment, name, description, titles, etc.

thnx

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
  • Recently Browsing   0 members

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