是这样吗?这是我做《软件菜单》时的练习。#include <Constants.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Dim $z = 1
GUICreate('ListView分组线', 600, 450)
$ListView1 = GUICtrlCreateListView('', 5, 5, 590, 400)
GUICtrlSetColor(-1, 0x0080C0);设置控件中的文本色
_GUICtrlListView_SetColumnWidth($ListView1, 0, 200)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))
_GUICtrlListView_SetBkColor($ListView1, $CLR_MONEYGREEN);设置控件背景色
_GUICtrlListView_SetTextBkColor($ListView1, $CLR_MONEYGREEN);设置控件中文本的背景色
_GUICtrlListView_SetOutlineColor($ListView1, 0x0000FF);设置边框色
_GUICtrlListView_SetView($ListView1, 1)
$But1 = GUICtrlCreateButton('添加', 110, 410, 80, 30, $WS_GROUP)
CreateGroup($ListView1, 1, '分组线', '项目-0', 'shell32.dll')
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3
Exit
Case $But1
CreateGroup($ListView1, 1, '分组线', '新建项目-' & $z, 'shell32.dll')
$z += 1
EndSwitch
WEnd
Func CreateGroup($hWnd, $iGroupID, $sHeader, $sText, $sImageFile);创建分组:参数1控件句柄、参数2分组ID、参数3分组标题、参数4项目文本、参数5项目图标。
GUICtrlCreateListViewItem($sText, $hWnd)
GUICtrlSetImage(-1, $sImageFile, 14)
EndFunc ;==>CreateGroup
|