找回密码
 加入
搜索
查看: 3173|回复: 4

[GUI管理] 如何更改用数组显示的listview某一行颜色

[复制链接]
发表于 2012-4-22 17:17:26 | 显示全部楼层 |阅读模式
本帖最后由 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


不用消息的。。比较简单。。
发表于 2012-4-22 17:59:36 | 显示全部楼层
回复 1# biwfmm

发帖前最好在论坛搜索一下!
对您来说可能省下学习时间, 对论坛来说减少了不必要的资源开销!

设置 listview 某行数据的颜色?
http://www.autoitx.com/forum.php ... ;highlight=listview

关于listview改变整列的底色
http://www.autoitx.com/forum.php ... ;highlight=listview

评分

参与人数 3金钱 +50 贡献 +3 收起 理由
afan + 2
xms77 + 30 + 1 先搜索在提问的方式是正确的
水木子 + 20

查看全部评分

发表于 2012-4-22 18:58:17 | 显示全部楼层
这个论坛早就讨论过的,有实例的。
发表于 2012-4-22 20:39:38 | 显示全部楼层
日,又是个懒到怕自己动手会over的主
发表于 2012-4-22 21:20:54 | 显示全部楼层
回复 4# netegg
呵呵,蛋哥有点蛋疼了,要淡定!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 23:38 , Processed in 0.094858 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表