[已解决]如何清除ListView控件内的信息
本帖最后由 mshuking 于 2014-12-12 15:41 编辑#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <GuiStatusBar.au3>
#include <ComboConstants.au3>
#include <AVIConstants.au3>
#include <GuiTreeView.au3>
#include <Timers.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Local $aParts = ;定义状态栏
$Form1 = GUICreate("GUI例子", 720, 550, -1, -1, $WS_OVERLAPPEDWINDOW);创建一个 GUI 窗口
GUISetIcon(@SystemDir & "\mspaint.exe", 0);设置窗口图标
;-----------------------------------------------------------------------------------------------
$menu_A = GUICtrlCreateMenu("菜单1[&O]");创建一个菜单控件
$menu_A1 = GUICtrlCreateMenuItem("关于[&S]", $menu_A);创建一个菜单项目控件
$menu_A2 = GUICtrlCreateMenuItem("关于[&S]", $menu_A);创建一个菜单项目控件
$menu_A3 = GUICtrlCreateMenuItem("关于[&S]", $menu_A);创建一个菜单项目控件
$menu_B = GUICtrlCreateMenu("菜单2[&T]");创建一个菜单控件
$menu_B1 = GUICtrlCreateMenuItem("关于[&S]", $menu_B);创建一个菜单项目控件
$menu_B2 = GUICtrlCreateMenuItem("关于[&S]", $menu_B);创建一个菜单项目控件
$menu_B3 = GUICtrlCreateMenuItem("关于[&S]", $menu_B);创建一个菜单项目控件
;-----------------------------------------------------------------------------------------------
;创建一个分组(Group)控件
$CreateGroup1 = GUICtrlCreateGroup("ListView 控件例子", 10, 10, 593, 417)
GUICtrlSetResizing($CreateGroup1, $GUI_DOCKBORDERS);设置某个控件的大小调整方式
;创建一个 ListView 控件
$hListView1 = GUICtrlCreateListView("机号|IP|时间|信息|状态", 40, 40, 480, 320)
_GUICtrlListView_SetExtendedListViewStyle($hListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES));添加网格
_GUICtrlListView_SetColumn($hListView1, 0, "机号", 50, 2);设置列属性
_GUICtrlListView_SetColumn($hListView1, 1, "IP", 140, 2)
_GUICtrlListView_SetColumn($hListView1, 2, "时间", 80, 2)
_GUICtrlListView_SetColumn($hListView1, 3, "信息", 140, 2)
_GUICtrlListView_SetColumn($hListView1, 4, "状态", 50, 2)
GUICtrlSetColor($hListView1, 0x0055ff);设置指定控件的文本颜色
GUICtrlSetResizing($hListView1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKMENUBAR);设置某个控件的大小调整方式
$menu_C = GUICtrlCreateContextMenu($hListView1);创建上下文菜单(右键)
$menu_C1 = GUICtrlCreateMenuItem("清除信息[&Q]", $menu_C);创建一个菜单项目控件
GUICtrlCreateMenuItem("", $menu_C);创建一个菜单项目控件
$menu_C2 = GUICtrlCreateMenuItem("读取信息[&V]", $menu_C);创建一个菜单项目控件
;-----------------------------------------------------------------------------------------------
;状态栏
$StatusBar1 = _GUICtrlStatusBar_Create($Form1, $aParts)
_GUICtrlStatusBar_SetText($StatusBar1, today() & "" & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & "系统:" & @OSVersion, 1)
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & "计算机名:" & @ComputerName, 2)
_GUICtrlStatusBar_SetIcon($StatusBar1, 0, _WinAPI_LoadShell32Icon(1));设置状态栏图标
_GUICtrlStatusBar_SetIcon($StatusBar1, 1, _WinAPI_LoadShell32Icon(2));设置状态栏图标
GUIRegisterMsg($WM_SIZE, "WM_SIZE");调整状态栏位置
Sleep(500)
SplashOff();关闭闪屏图片
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $menu_A1
MsgBox(266304, "关于", "演示制作:kodin")
Case $menu_C1
;怎么写 清除作息
EndSwitch
WEnd
;返回当前时间
Func _UpdateStatusBarClock($hWnd, $msg, $iIDTimer, $dwTime)
_GUICtrlStatusBar_SetText($StatusBar1, today() & "" & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
EndFunc ;==>_UpdateStatusBarClock
;返回当前日期
Func today()
Return (@YEAR & "年" & @MON & "月" & @MDAY & "日")
EndFunc ;==>today _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView);清空 回复 2# austere
恐怕lz只是想清除内容,不改变结构,用这个,结构都没了 回复 3# netegg
{:face (411):}...... 蛋神,我只会这一个~~结构也可以再建的嘛....
页:
[1]