找回密码
 加入
搜索
查看: 8497|回复: 19

[AU3基础] 如何使listview里面的项变成灰色,也就是不可用状态【已解决】

 火.. [复制链接]
发表于 2011-2-23 18:31:18 | 显示全部楼层 |阅读模式
本帖最后由 binshiwo 于 2011-2-26 11:52 编辑

如题。combo里面和listview是对应的。如果我选中combo里面的一项,如何使对应里面的combo里面的项变成灰色,也就是不可用状态。
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$ListView1 = GUICtrlCreateListView("number      |    name  ", 72, 88, 361, 233)
GUICtrlCreateListViewItem("1|big", $ListView1)
GUICtrlCreateListViewItem("2|small", $ListView1)
GUICtrlCreateListViewItem("3|mid", $ListView1)
$combo = GUICtrlCreateCombo("", 192, 24, 113, 25)
GUICtrlSetData(-1,"small|big|mid","small")
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

答案在 17#。
发表于 2011-2-23 22:09:54 | 显示全部楼层
标题很有挑战性,不过内容我实在看不明白楼主你想做什么
 楼主| 发表于 2011-2-24 09:11:24 | 显示全部楼层
回复 2# ceoguang


  我是想用来添加数据。COMBO里面是数据类型。有三类数据类型:“small,big,mid”,small 类数据包含了所有的项目的内容。big类数据则只包含其中一个项目的内容。mid类数据也只包含一个项目的内容。当选择small类数据时就将所有item变为可用,当选择其他的数据类型时,只将其对应的item为可用而其他的item则不可用。
发表于 2011-2-24 15:05:09 | 显示全部楼层
本帖最后由 小A 于 2011-2-24 15:09 编辑


#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$ListView1 = GUICtrlCreateListView("number      |    name  ", 72, 88, 361, 233)
GUICtrlCreateListViewItem("1|big", $ListView1)
GUICtrlCreateListViewItem("2|small", $ListView1)
GUICtrlCreateListViewItem("3|mid", $ListView1)
$combo = GUICtrlCreateCombo("", 192, 24, 113, 25)
GUICtrlSetData(-1,"small|big|mid","small")
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                                Case $combo
                                        ;ControlDisable($Form1,'',_GUICtrlListView_GetItemParam ($ListView1,2))
                                        ControlDisable($Form1,'',$ListView1)
                                        MsgBox(0,'',GUICtrlRead($combo))
                EndSwitch
WEnd 




可能楼主想要的结果跟这个差不多,但是禁用单个项目还要等待高手解答!
发表于 2011-2-24 16:23:15 | 显示全部楼层
disable,。
 楼主| 发表于 2011-2-24 16:42:25 | 显示全部楼层
可能楼主想要的结果跟这个差不多,但是禁用单个项目还要等待高手解答!
小A 发表于 2011-2-24 15:05



我想要的最终结果就是可以禁用单个项目.
非常感谢你。同期待答案中!
发表于 2011-2-24 17:26:09 | 显示全部楼层
本帖最后由 小A 于 2011-2-24 17:30 编辑

不知道这样行不,
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$ListView1 = GUICtrlCreateListView("number      |    name  ", 72, 88, 361, 233)
GUICtrlCreateListViewItem("1|big", $ListView1)
GUICtrlCreateListViewItem("2|small", $ListView1)
GUICtrlCreateListViewItem("3|mid", $ListView1)
$combo = GUICtrlCreateCombo("", 192, 24, 113, 25)
GUICtrlSetData(-1,"small|big|mid","small")

GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $combo
                        ;ControlDisable($Form1,'',_GUICtrlListView_GetItemParam ($ListView1,2))
                        $item = ControlListView($Form1,'',$ListView1,"FindItem", GUICtrlRead($combo),1)
                        If $item <> -1 Then                                                
                              GUICtrlSetColor(_GUICtrlListView_GetItemParam($ListView1,$item), 0xFF0000)
                              ;MsgBox(0,'',GUICtrlRead($combo))
                       EndIf
                       ;ControlDisable($Form1,'',$ListView1)                                        
                 EndSwitch
WEnd 



不知道怎么回事,代码粘贴到这里后,就变很好乱了。
发表于 2011-2-24 19:16:32 | 显示全部楼层
楼主连个效果图都不给,不猜了
发表于 2011-2-24 19:41:31 | 显示全部楼层
楼主要的是禁用状态,就是灰色不可用!
楼上的几位都没成功
也期待有牛人能出事例
发表于 2011-2-24 20:07:46 | 显示全部楼层
什么叫禁用状态,是灰色不可选(项目可直接跳过,鼠标点选不上),还是灰色但是可选(不是选取及操作,是光变背景色,操作无效)
 楼主| 发表于 2011-2-25 09:43:41 | 显示全部楼层
楼主连个效果图都不给,不猜了
netegg 发表于 2011-2-24 19:16



这就是效果图了!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-2-25 13:28:11 | 显示全部楼层
回复 11# binshiwo

在简单说明下,如果都是值或都是复选稍微可能还好办些,这样穿插着可能要复杂得多,试试吧
 楼主| 发表于 2011-2-25 17:15:13 | 显示全部楼层
回复  binshiwo

在简单说明下,如果都是值或都是复选稍微可能还好办些,这样穿插着可能要复杂得多,试试 ...
netegg 发表于 2011-2-25 13:28


恩。是穿插的。我再截了两张图比较,可能这样能看的更清楚些

另一类型:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-2-25 17:53:41 | 显示全部楼层
我知道,不过你这个行和行都不是一个玩意,不大好整
发表于 2011-2-25 21:55:23 | 显示全部楼层
点击灰色的Item时,是个什么效果?不会选中?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-12 04:44 , Processed in 0.083803 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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