本帖最后由 republican 于 2011-5-1 19:25 编辑
我现在想实现第一列不显示图标且不额外占用位置,而其他列可以显示图标的效果。
但目前没找到方法仅仅删除第一列的图标,遂希望给位帮忙看看,谢谢!
以下代码仅仅是显示不存在的图标,且占用位置,希望能获得各位的指点,谢谢。
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
Opt('MustDeclareVars', 1)
;~ $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
_Main()
Func _Main()
Local $hImage, $hListView
; 创建界面
GUICreate("列表中添加子项", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
;~ _GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()
; 加载图像
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($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", 100)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1,0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 100)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1,1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 100)
;~ _GUICtrlListView_DeleteColumn($hListView, 0)
; 循环至用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
|