|
本帖最后由 biwfmm 于 2012-4-22 17:40 编辑
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>
$hGui = GuiCreate('更改指定ListView的字体颜色', 400, 300)
Local $lvsExStyle = BitOr($lvs_ex_fullrowselect, _
$lvs_ex_gridlines, _
$lvs_ex_doublebuffer)
Local $lvs1 = GuiCtrlCreateListView("List1||", 5, 5, 390, 260, $lvs_report, $lvsExStyle)
$Button1 = GUICtrlCreateButton("更改颜色", 104, 270, 75, 25)
$Input1 = GUICtrlCreateInput("0xFF0000", 192, 272, 121, 21)
Local $var[10][1]
For $d = 0 to 9
$var[$d][0] = $d
Next
_GUICtrlListView_AddArray( $lvs1,$var)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_GuiListView_SetItemColor($lvs1,GUICtrlRead($Input1))
EndSwitch
WEnd
;~ 改变指定 ListView 项目的字体颜色
Func _GuiListView_SetItemColor($hWnd, $Color)
$iItem = _GUICtrlListView_GetItemParam($hWnd,_GUICtrlListView_GetSelectionMark($hWnd))
Return GUICtrlSetColor($iItem, $Color)
EndFunc
不用消息的。。比较简单。。 |
|