#cs ____________________________________
AutoIt 版本: 3.2.11.0(第一版)
脚本作者:
Email:
QQ/TM:
脚本版本:
脚本功能:
#ce _______________脚本开始_________________
;#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
Opt("GUIOnEventMode", 1)
Global $Title="my title"
Global $ListView1,$wl
$h_GUI = GUICreate($Title,410,230)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
;问题是添加控件项目后,在刷新时ListView控件就会闪烁,而且慢了很多
$tab = GUICtrlCreateTab(5,5,400,200) ; 1.不用Tab就正常
GUISetFont (9, 400)
;第1分页
$tab0 = GUICtrlCreateTabItem("tab0") ; 2.不添加控件项目也会正常
$Ok=GUICtrlCreateButton("刷新",350,50)
GUICtrlSetOnEvent($Ok,"OK")
$ListView1 = GUICtrlCreateListView("简称|全称|编号", 40, 40, 300,140)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES));, $LVS_EX_TRACKSELECT))
_GUICtrlListView_SetColumnWidth($ListView1, 0, 40)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 150)
_GUICtrlListView_SetColumnWidth($ListView1, 2, 40)
$wl = IniReadSection("file.ini", "myfile")
If @error Then
MsgBox(0, "", "错误,无法打开配置文件!")
EndIf
;GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func Close()
Exit
EndFunc
;~ Func OK()
;~ _GUICtrlListView_DeleteAllItems($ListView1)
;~ ;MsgBox(0,"","个数"&$wl[0][0])
;~ For $i = 1 To $wl[0][0]
;~ GUICtrlCreateListViewItem($wl[$i][1]&"|"&$wl[$i][0],$ListView1)
;~ Next
;~ MsgBox(0,"","结束")
;~ EndFunc
Func OK()
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
Global $n=0
For $i = 1 To $wl[0][0]
$var=StringSplit($wl[$i][1],"|")
;MsgBox(64,"",$var[1])
;GUICtrlCreateListViewItem($wl[$i][1]&"|"&$wl[$i][0],$ListView1)
_GUICtrlListView_AddItem($ListView1, $var[1])
_GUICtrlListView_AddSubItem($ListView1, $n,$var[2],1)
_GUICtrlListView_AddSubItem($ListView1, $n,$wl[$i][0],2)
_GuiListView_SetItemColor($ListView1, 0xEEEEEE,$n)
;~ $iID = _GUICtrlListView_MapIndexToID($ListView1, $n)
;~ GUICtrlSetBkColor(GUICtrlRead($iID) ,0xEEEEEE)
$n+=1
Next
MsgBox(0,"","结束")
EndFunc
Func _GuiListView_SetItemColor($hWnd, $Color,$index)
;MsgBox(64,"",_GUICtrlListView_GetSelectionMark($hWnd))
$iItem = _GUICtrlListView_GetItemParam($hWnd,$index)
Return GUICtrlSetbkColor($iItem, $Color)
EndFunc
以上代码设置交叉背景色无效,请教~ |