【已解决】请问带复选框的Listview如何实现点击任意列数据进行勾选并改变字体属性
本帖最后由 fengjie 于 2020-3-27 01:50 编辑请教几个关于带复选框的Listview的问题,看了UDF也找不到该如何实现,希望大家不吝赐教。
1、请问如何实现点击任意列数据也可以进行勾选
2、请问如何实现勾选某一行后即可对该行文本字体设置加粗、变红色,并改变背景颜色,取消勾选后恢复
3、请问如何实现勾选某一行后焦点依然在Button1?
小弟先在此谢过了!
界面如下图:
代码如下:#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
$Form = GUICreate("测试", 420, 280, -1, -1)
$Group1 = GUICtrlCreateGroup("请勾选您要设置的项目", 165, 15, 250, 165)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;要生成复选框, 使用 扩展样式 $LVS_EX_CHECKBOXES
;要使整行显示选中状态, 使用 扩展样式 $LVS_EX_FULLROWSELECT
$ListView1 = GUICtrlCreateListView("序号|数值", 175, 30, 230, 140, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))
;设置列宽度
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100)
$ListView1_0 = GUICtrlCreateListViewItem("001|1111111111", $ListView1)
$ListView1_0 = GUICtrlCreateListViewItem("002|2222222222", $ListView1)
$ListView1_0 = GUICtrlCreateListViewItem("003|3333333333", $ListView1)
$ListView1_0 = GUICtrlCreateListViewItem("004|4444444444", $ListView1)
$ListView1_0 = GUICtrlCreateListViewItem("005|5555555555", $ListView1)
$Button1 = GUICtrlCreateButton("确定执行(Y)", 90, 210, 80, 25)
GUICtrlSetState(-1,$GUI_FOCUS)
$Button2 = GUICtrlCreateButton("退出程序(N)", 250, 210, 80, 25)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form, "int", 500, "long", 0x00080000);fade-in
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;设置热键
HotKeySet("Y", "_Continue")
HotKeySet("y", "_Continue")
HotKeySet("N", "_Quit")
HotKeySet("n", "_Quit")
While 1
$nMsg = GUIGetMsg() ;捕获窗口消息
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button2
_Quit()
Case $Button1
_Continue()
EndSwitch
WEnd
Func _Continue()
MsgBox(4160, "测试", "继续执行", 0)
EndFunc ;==>_Continue
Func _Quit() ;退出程序
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form, "int", 500, "long", 0x00090000);fade-out
Exit
EndFunc ;==>_Quit
本帖最后由 netegg 于 2015-3-16 07:25 编辑
http://www.autoitx.com/thread-15686-1-1.html这是第二,三个问题
第一个问题没看明白(如果不是点击列标题),加个$LVS_EX_FULLROWSELECT 样式就行了 回复 2# netegg
非常感谢蛋大的回复,我试一下看
页:
[1]