回复 2# kk_lee69
感谢kk_lee69 版主的回复
前面也有考虑过用_GUICtrlListView
_GUICtrlListView创建的表没有GUICtrlCreateListView的好看,想和GUICtrlCreateListView一样有个边框,另外GUICtrlCreateListView添加项目一排能搞定比较方便,如GUICtrlCreateListView能指定图标大小就非常完美了。
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $hGui, $idListview, $hImage
Local $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES);项目和子项显示网格.,该项及其所有子项高亮显示.,允许显示子项目图像.
$hGui = GUICreate("添加图标到图像列表")
Local $idOK = GUICtrlCreateButton("确定", 310, 370, 85, 25)
Local $label = GUICtrlCreateLabel("如何调整使 GUICtrlSetImage 设置的图标变大", 15, 270)
GUICtrlSetColor(-1, 255)
$idListview = _GUICtrlListView_Create($hGui, "", 15, 15, 365, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT));始终显示被选项目.列标题不作为按钮类型工作.,控件样式为报表视图.
_GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
GUISetState(@SW_SHOW)
; 加载图像
$hImage = _GUIImageList_Create(20, 20, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($idListview, $hImage, 1)
; 添加列
_GUICtrlListView_AddColumn($idListview, "列表 1", 70)
_GUICtrlListView_AddColumn($idListview, "列表 2", 70)
_GUICtrlListView_AddColumn($idListview, "列表 3", 70)
_GUICtrlListView_AddColumn($idListview, "列表 4", 70)
_GUICtrlListView_AddColumn($idListview, "列表 5", 70)
; 添加项目
_GUICtrlListView_AddItem($idListview, "图标 1", 0)
_GUICtrlListView_AddSubItem($idListview, 0, "列 2", 1)
_GUICtrlListView_AddSubItem($idListview, 0, "列 3", 2)
_GUICtrlListView_AddSubItem($idListview, 0, "列 4", 3)
_GUICtrlListView_AddSubItem($idListview, 0, "列 5", 4)
_GUICtrlListView_AddItem($idListview, "图标 2", 1)
_GUICtrlListView_AddSubItem($idListview, 1, "列 2", 1)
_GUICtrlListView_AddSubItem($idListview, 1, "列 3", 2)
_GUICtrlListView_AddSubItem($idListview, 1, "列 4", 3)
_GUICtrlListView_AddSubItem($idListview, 1, "列 5", 4)
_GUICtrlListView_AddItem($idListview, "图标 1", 3)
_GUICtrlListView_AddSubItem($idListview, 2, "列 2", 1)
_GUICtrlListView_AddSubItem($idListview, 2, "列 3", 2)
_GUICtrlListView_AddSubItem($idListview, 2, "列 4", 3)
_GUICtrlListView_AddSubItem($idListview, 2, "列 5", 4)
_GUICtrlListView_AddItem($idListview, "图标 1", 4)
_GUICtrlListView_AddSubItem($idListview, 3, "列 2", 1)
_GUICtrlListView_AddSubItem($idListview, 3, "列 3", 2)
_GUICtrlListView_AddSubItem($idListview, 3, "列 4", 3)
_GUICtrlListView_AddSubItem($idListview, 3, "列 5", 4)
_GUICtrlListView_AddItem($idListview, "图标 1", 5)
_GUICtrlListView_AddSubItem($idListview, 4, "列 2", 1)
_GUICtrlListView_AddSubItem($idListview, 4, "列 3", 2)
_GUICtrlListView_AddSubItem($idListview, 4, "列 4", 3)
_GUICtrlListView_AddSubItem($idListview, 4, "列 5", 4)
; 循环到用户退出.
Do
Switch GUIGetMsg()
Case $idOK
ExitLoop
EndSwitch
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example
|