Jump to content

Listview-Item Backgroundcolor


Tam0r
 Share

Recommended Posts

Hi.

I've got following problem; I've created a listview with several items with alternating background colors (white and blue). Now I want to change the background color of only one item I've selected somewhere in the middle of the list, but I didn't find any command for this. Do I have to rebuild the entire listview or can I change the background color of an item?

Link to comment
Share on other sites

Hi.

I've got following problem; I've created a listview with several items with alternating background colors (white and blue). Now I want to change the background color of only one item I've selected somewhere in the middle of the list, but I didn't find any command for this. Do I have to rebuild the entire listview or can I change the background color of an item?

Could you please show some code so that we can better help you.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Could you please show some code so that we can better help you.

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#Include <GuiCombo.au3>

Opt("GUIOnEventMode", 1)

$1 = GUICreate ("Checklist Creater", 1100, 800)

$tab=GUICtrlCreateTab (600,50, 460,650)
$Allgemein=GUICtrlCreateTabitem ("Allgemein")
$Allgemein1=GUICtrlCreateListview ("Anzahl | Material", 600,73,457,640 ,BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL))

GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xc3e1ff) 
GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xF8F8FF)
GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xc3e1ff) 
GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xF8F8FF)
GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xc3e1ff) 

$generieren = GUICtrlCreateButton ( "Generiere Checkliste", 340,240)
GUICtrlSetOnEvent($generieren, "_generiere")
GUISetState(@SW_show, $1)
GUICtrlSetState($Allgemein,$GUI_SHOW)


While 1
sleep (10) 
WEnd



Func _generiere()
; Here should the color of e.g. item 2 change to grey or something like this
EndFunc

Autoit Version:autoit-v3.1.1.110.exe

Edited by Tam0r
Link to comment
Share on other sites

#include <GUIConstants.au3>
#Include <GuiListView.au3>
#Include <GuiCombo.au3>

;~ Opt("GUIOnEventMode", 1)

$1 = GUICreate ("Checklist Creater", 1100, 800)

$tab=GUICtrlCreateTab (600,50, 460,650)
$Allgemein=GUICtrlCreateTabitem ("Allgemein")
$Allgemein1=GUICtrlCreateListview ("Anzahl | Material", 600,73,457,640 ,BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL))

$lv1 = GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xc3e1ff) 
$lv2 = GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xF8F8FF)
$lv3 = GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xc3e1ff) 
$lv4 = GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xF8F8FF)
$lv5 = GUICtrlCreateListViewItem ( "1 |2 ", $Allgemein1 )
GUICtrlSetBkColor(-1,0xc3e1ff) 


$generieren = GUICtrlCreateButton ( "Generiere Checkliste", 340,240)
GUICtrlSetOnEvent($generieren, "_generiere")
GUISetState(@SW_show, $1)
GUICtrlSetState($Allgemein,$GUI_SHOW)

;~ While 1
;~  Sleep ( 10 )
;~ WEnd

While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = $GUI_EVENT_CLOSE
   Exit
  Case $msg = $lv1
   GUICtrlSetBkColor($lv1,0xff0000) 
  Case $msg = $lv2
   GUICtrlSetBkColor($lv2,0xff0000) 
  Case $msg = $lv3
   GUICtrlSetBkColor($lv3,0xff0000) 
  Case $msg = $lv4
   GUICtrlSetBkColor($lv4,0xff0000) 
  Case $msg = $lv5
   GUICtrlSetBkColor($lv5,0xff0000) 
 EndSelect
WEnd

 

Func _generiere()
; Here should the color of e.g. item 2 change to grey or something like this
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...