找回密码
 加入
搜索
楼主: blue_dvd

[系统综合] 如何获取Listview第2行控件行标识?【已解决】

 火.. [复制链接]
 楼主| 发表于 2016-11-24 11:19:47 | 显示全部楼层
回复 13# kk_lee69

kk_lee69大哥,我贴出代码了,你看看,写入listview的方式不同,代码写底色确不同效果!
 楼主| 发表于 2016-11-24 11:24:52 | 显示全部楼层
回复 14# chzj589
我主要是想用
_GUICtrlListView_AddArray($ListView1, $aShowdata)
快速列表,但用了这个函数,写行底色确不行了!
发表于 2016-11-24 13:28:02 | 显示全部楼层
本帖最后由 chzj589 于 2016-11-24 13:33 编辑

回复 15# blue_dvd

写这样的代码要做什么?
为何不将自己写的发上来?

本帖子中包含更多资源

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

×
发表于 2016-11-24 14:02:29 | 显示全部楼层
回复 17# blue_dvd


    http://www.autoitx.com/forum.php ... ;highlight=listview

這裡不就是完全是你需要的??

评分

参与人数 1金钱 +22 收起 理由
blue_dvd + 22

查看全部评分

发表于 2016-11-24 14:04:19 | 显示全部楼层
回复 16# blue_dvd


或者  你不要用 _GUICtrlListView_AddArray

用原本的方法  可以解決 閃  的問題....

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <ColorConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 591, 349, 192, 114)
$ListView1 = GUICtrlCreateListView("", 24, 24, 546, 302)
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
_GUICtrlListView_AddColumn($ListView1, "Item1",100)
_GUICtrlListView_AddColumn($ListView1, "nSubItem1", 100)
_GUICtrlListView_AddColumn($ListView1, "nSubItem2", 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $GUI, $hImage, $iITEM_COUNT =1000

Local $sSomeString = ""

Local $aBoy[$iITEM_COUNT][3]

For $i = 0 To $iITEM_COUNT - 1;初始化??

        $aBoy[$i][0] = "??" & $i

        $aBoy[$i][1] = "爸爸" & $i

        $aBoy[$i][2] = "儿子" & $i

Next

Local $aShowdata = $aBoy

_GUICtrlListView_BeginUpdate($ListView1)
for $i=0 to  UBound($aShowdata ,1)-1

         $t_a=$aShowdata[$i][0]
        For $j=1 To  UBound($aShowdata,2) - 1
            $t_a=$t_a&"|"&$aShowdata[$i][$j]
        Next
       ;MsgBox(0,"提醒", $t_a)

        GUICtrlCreateListViewItem($t_a,$ListView1)

Next

;?置列?
         For $i = 0 To UBound($aShowdata ,2) - 1
                _GUICtrlListView_SetColumnWidth($ListView1, $i, $LVSCW_AUTOSIZE) ;?置列??不懂
         Next

     local $ii=0
     ;?置行?隔?色
         For $i = 0 To UBound($aShowdata,1) - 1

                  if  mod($i,2)=0 Then
                     ; $ii= _GUICtrlListView_SetItemSelected($ListView1, $i)
                     ; $a = ControlListView($form1, "", $ListView1, "GetSelected", $ii)
                                         ; ConsoleWrite($a&@CRLF)
              GUICtrlSetBkColor(_GUICtrlListView_GetItemParam($ListView1, $i), $COLOR_BLUE) ;?色
                                        ConsoleWrite(_GUICtrlListView_GetItemParam($ListView1, $i)&@CRLF)
                 EndIf

        Next

_GUICtrlListView_EndUpdate($ListView1)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
发表于 2016-11-24 14:32:25 | 显示全部楼层
回复 17# blue_dvd

簡單做個結論

使用 _GUICtrlListView_AddArray 出來的東西因為結構不一樣,因此有很多事無法使用的 譬如
你想設定寬度  _GUICtrlListView_SetColumnWidth 會失效
想設定背景 GUICtrlSetBkColor  會失效

所以你得 註冊函數 然後 自己手動處理...... WM_NOTIFY
不這樣做 是無法達到你的要求..................

不然就得 採用傳統的方式.....
 楼主| 发表于 2016-11-24 21:47:42 | 显示全部楼层
回复 21# kk_lee69

谢谢,终于搞定了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-26 11:01 , Processed in 0.069637 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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