本帖最后由 ≈※爖※≈ 于 2010-3-18 22:51 编辑 #include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hGui = GuiCreate('更改指定ListView的字体颜色', 400, 300)
Local $lvsExStyle = BitOr($lvs_ex_fullrowselect, _
$lvs_ex_gridlines, _
$lvs_ex_doublebuffer)
Local $lvs1 = GuiCtrlCreateListView("List1|View|Test", 5, 5, 390, 260, $lvs_report, $lvsExStyle)
$Button1 = GUICtrlCreateButton("更改颜色", 104, 270, 75, 25)
$Input1 = GUICtrlCreateInput("0xFF0000", 192, 272, 121, 21)
For $d = 1 to 20
$var = "lvs item " & $d
$var &= "|" & $var & " - 1|" & $var & " - 2"
GuiCtrlCreateListViewItem($var, $lvs1)
Next
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
|