sandyd Posted January 6, 2006 Share Posted January 6, 2006 A happy new year to all, Quick question: Whats the code to color a single item ina listbox, either the background or the foreground for the item? Is it possible? Thanks in adavnce. ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
seandisanti Posted January 6, 2006 Share Posted January 6, 2006 A happy new year to all,Quick question: Whats the code to color a single item ina listbox, either the background or the foreground for the item?Is it possible?Thanks in adavnce.it looks to me like it's impossible to set colors for a single item element of the control. i have a script where i set the font of the listview to white and the gui transparency so that it's mostly transparent when the gui isn't the active window, and i change the font color for the whole control with GUICtrlSetColor(). one thing that you could try, although i think it would probably be more work than you're willing to do; would be to get larry's UDF for writing directly to the screen, and create a text region with the same font and position as the element that you want to color. You could then give the illusion that one or more elements are different from the rest visually. If i run into enough extra time at work today, i'll see if i can't make a _guilistviewcoloritem() UDF with that concept... Link to comment Share on other sites More sharing options...
CyberSlug Posted January 6, 2006 Share Posted January 6, 2006 See http://www.autoitscript.com/forum/index.php?showtopic=15110If all else fails, you can simulate a list with TreeView in the current beta version of AutoIt. (In addition to the example below, you can look at the GUICtrlCreateTreeViewItem example in the beta help file)#include <GuiConstants.au3> GUICreate("My GUI with treeview", 350, 212) $treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOr($TVS_HASLINES, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $a = GUICtrlCreateTreeViewitem("One Item", $treeview) $b = GUICtrlCreateTreeViewitem("A Green Item", $treeview) $c = GUICtrlCreateTreeViewitem("Another Item", $treeview) GUICtrlSetColor($a, 0xFF0000) GUICtrlSetColor($b, 0x00FF00) GUICtrlSetColor($c, 0x0000FF) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
seandisanti Posted January 6, 2006 Share Posted January 6, 2006 See http://www.autoitscript.com/forum/index.php?showtopic=15110 If all else fails, you can simulate a list with TreeView in the current beta version of AutoIt. (In addition to the example below, you can look at the GUICtrlCreateTreeViewItem example in the beta help file) #include <GuiConstants.au3> GUICreate("My GUI with treeview", 350, 212) $treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOr($TVS_HASLINES, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $a = GUICtrlCreateTreeViewitem("One Item", $treeview) $b = GUICtrlCreateTreeViewitem("A Green Item", $treeview) $c = GUICtrlCreateTreeViewitem("Another Item", $treeview) GUICtrlSetColor($a, 0xFF0000) GUICtrlSetColor($b, 0x00FF00) GUICtrlSetColor($c, 0x0000FF) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEndah, very good, thanks again CS Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now