找回密码
 加入
搜索
查看: 2595|回复: 7

[AU3基础] 请教一下ListView能不能加个图片做背景?

  [复制链接]
发表于 2011-10-29 21:56:50 | 显示全部楼层 |阅读模式
ListView能不能加个图片做背景?
还有ListView加$LVS_EX_GRIDLINES之后,双击无法获取双击的内容
发表于 2011-10-29 22:19:58 | 显示全部楼层
試試
_GUICtrlListView_SetBkImage($hListView, $sFilePath)
发表于 2011-10-29 22:30:15 | 显示全部楼层
試試
_GUICtrlListView_SetBkImage($hListView, $sFilePath)
rchockxm 发表于 2011-10-29 22:19


只能用于 _GUICtrlListView_Create 创建的控件,并且图片路径中不能含有U码字符。
 楼主| 发表于 2011-10-29 22:41:25 | 显示全部楼层
只能用于 _GUICtrlListView_Create 创建的控件,并且图片路径中不能含有U码字符。
水木子 发表于 2011-10-29 22:30



    是的,原来用GUICtrlCreateListView创建,不好使。。刚刚发现了_GUICtrlListView_Create创建的才行,
谢谢楼上两位,

还有ListView加$LVS_EX_GRIDLINES之后,双击无法获取双击的内容,如何解决?
 楼主| 发表于 2011-10-29 22:45:21 | 显示全部楼层
换成_GUICtrlListView_Create,双击列表无响应了
发表于 2011-10-29 23:53:13 | 显示全部楼层
换成_GUICtrlListView_Create,双击列表无响应了
auto 发表于 2011-10-29 22:45


看一下返回值
_GUICtrlListView_Create 是 Handle
GUICtrlCreateListView 是 controlID
发表于 2011-10-30 09:17:14 | 显示全部楼层
回复 6# rchockxm
是这样吗?

#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

$GUI = GUICreate("(UDF Created) ListView Create", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 396, 280)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES))

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
GUISetState()

Do
Until GUIGetMsg() = -3
GUIDelete()

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
        $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
        $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
        $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
        $iCode = DllStructGetData($tNMHDR, "Code")
        Switch $hWndFrom
                Case $hListView
                        Switch $iCode
                                Case $NM_DBLCLK
                                        MsgBox(0, '', '')
                        EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
发表于 2011-10-30 09:59:46 | 显示全部楼层
楼上正解。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-20 22:30 , Processed in 0.071999 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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