asdf22 Posted April 24, 2009 Posted April 24, 2009 (edited) How to set BkColor only on line 3 in _GUICtrlListView expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListView.au3> Global $hGUIForm, $sHeaderText, $iItemIndex $hGUIForm = GUICreate("_GUICtrlListView", 600, 300) $sHeaderText = "Column1|Column2|Column3|Column4" $hListView = _GUICtrlListView_Create($hGUIForm, $sHeaderText, 5, 5, 590, 290) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) $iItemIndex = _GUICtrlListView_AddItem($hListView, 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_1", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_1", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_1", 3) $iItemIndex = _GUICtrlListView_AddItem($hListView, 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_2", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_2", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_2", 3) $iItemIndex =_GUICtrlListView_AddItem($hListView, 3) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_3", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_3", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_3", 3) GUISetState(@SW_SHOW) Dim $msg While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($hGUIForm) Exit Edited April 24, 2009 by asdf22
Zedna Posted April 24, 2009 Posted April 24, 2009 (edited) Look herehttp://www.autoitscript.com/forum/index.ph...st&p=524257changeDllStructSetData($tCustDraw, 'clrText', 0x5555DD)toDllStructSetData($tCustDraw, 'clrTextBk', 0xFFFF00) Edited April 24, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
asdf22 Posted April 24, 2009 Author Posted April 24, 2009 @Zedna, thanks I didn't understood what happens in the last code and my english is BAD I need the function ChangeColorLine() which sets the colour of the line which is marked. expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListView.au3> Global $hGUIForm, $sHeaderText, $iItemIndex, $button_ChangeColorLine $hGUIForm = GUICreate("_GUICtrlListView", 600, 300) $button_ChangeColorLine = GUICtrlCreateButton("ChangeColorLine", 350, 10, 90, 23) $sHeaderText = "Column1|Column2|Column3|Column4" $hListView = _GUICtrlListView_Create($hGUIForm, $sHeaderText, 5, 5, 320, 290) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) $iItemIndex = _GUICtrlListView_AddItem($hListView, 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_1", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_1", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_1", 3) $iItemIndex = _GUICtrlListView_AddItem($hListView, 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_2", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_2", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_2", 3) $iItemIndex =_GUICtrlListView_AddItem($hListView, 3) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_3", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_3", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_3", 3) GUISetState(@SW_SHOW) Func ChangeColorLine() ; code EndFunc Dim $msg While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button_ChangeColorLine ChangeColorLine() EndSelect WEnd GUIDelete($hGUIForm) Exit
Zedna Posted April 24, 2009 Posted April 24, 2009 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <Array.au3> Global $hGUIForm, $sHeaderText, $iItemIndex, $button_ChangeColorLine Global $aColoredLines[1] = [-1] $hGUIForm = GUICreate("_GUICtrlListView", 600, 300) $button_ChangeColorLine = GUICtrlCreateButton("ChangeColorLine", 350, 10, 90, 23) $sHeaderText = "Column1|Column2|Column3|Column4" $hListView = _GUICtrlListView_Create($hGUIForm, $sHeaderText, 5, 5, 320, 290) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) $iItemIndex = _GUICtrlListView_AddItem($hListView, 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_1", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_1", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_1", 3) $iItemIndex = _GUICtrlListView_AddItem($hListView, 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_2", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_2", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_2", 3) $iItemIndex =_GUICtrlListView_AddItem($hListView, 3) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "aa_3", 1) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "bb_3", 2) _GUICtrlListView_AddSubItem($hListView, $iItemIndex, "cc_3", 3) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) Func ChangeColorLine() $selected = _GUICtrlListView_GetNextItem($hListView) _ArrayAdd($aColoredLines, $selected) EndFunc Dim $msg While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button_ChangeColorLine ChangeColorLine() EndSelect WEnd GUIDelete($hGUIForm) Exit Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate('hwnd hwndFrom;int idFrom;int code;' & _ 'dword DrawStage;hwnd hdc;long rect[4];dword ItemSpec;int ItemState;dword Itemlparam;' & _ 'dword clrText;dword clrTextBk;int SubItem;' & _ 'dword ItemType;dword clrFace;int IconEffect;int IconPhase;int PartID;int StateID;long rectText[4];int Align', _ ;winxp or later $lParam) Local $iDrawStage = DllStructGetData($tCustDraw, 'DrawStage') If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW Local $iItem = DllStructGetData($tCustDraw, 'ItemSpec') If _ArraySearch($aColoredLines, $iItem) > 0 Then DllStructSetData($tCustDraw, 'clrTextBk', 0xFFFF00) Return $CDRF_NOTIFYITEMDRAW EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Edited April 24, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
asdf22 Posted April 24, 2009 Author Posted April 24, 2009 @Zedna, Thank you very much. Greetings from Bulgaria.
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