本帖最后由 qsy666888 于 2018-5-18 09:42 编辑
我想改变ListView表60几分的行的背景色和文本颜色,请大大们如何改?论坛的方法基本都用了,没有改得了。请赐教
#Include <GuiListView.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Include <GuiListView.au3>
#Include <GuiTreeView.au3>
_SQLite_Startup ()
$SQLite_Data_Path = "SQLite.db"
$Tablekj = "kaojuan"
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("从数据库里获取姓名示例", 478, 412, 481, 210)
GUISetFont(11, 400, 0, "宋体")
Global $ListView1 = GUICtrlCreateListView("序号|姓名|语文", 8, 8, 458, 358)
KC_lvdraw()
Global $Button1 = GUICtrlCreateButton("查看分数", 293, 376, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button1
msgbox(0,"70多分者", _get_N(7, 1))
msgbox(0,"分数个位数是5者", _get_N(5, 0))
EndSwitch
WEnd
Func _get_N($iNum, $iCode = 1)
Local $aRow, $hQuery, $sMsg = ''
Local $sQuery
If $iCode Then
$sQuery = "'" & $iNum & "%'"
Else
$sQuery = "'%" & $iNum & "'"
EndIf
_SQLite_Open ($SQLite_Data_Path)
_SQLite_Query(-1, "SELECT * FROM kaojuan WHERE 分数 LIKE " & $sQuery & ";", $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $sqlite_ok
$sMsg &= $aRow[0] & @TAB & $aRow[1] & @CRLF
WEnd
Return $sMsg
EndFunc
Func KC_lvdraw()
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
Local $Irval, $Aresult, $Irows, $Icolumns
$Irval = _SQLite_GetTable2d( _SQLite_Open ($SQLite_Data_Path), "select rowid,* from kaojuan;", $Aresult, $Irows, $Icolumns)
GUICtrlSetColor($ListView1, 0x000000)
_ArrayDelete($aresult, 0)
_GUICtrlListView_AddArray($ListView1, $Aresult)
; GUICtrlSetColor(_GUICtrlListView_GetItemParam($ListView1, 2), '0xFF0000') ;红色
; GUICtrlSetColor(_GUICtrlListView_GetItemParam($ListView1, 5), '0xFF0000') ;红色
GUICtrlSetBkColor(2,"0x00FF00")
GUICtrlSetColor(2,"0xFF0000")
EndFunc
|