|
本帖最后由 karlpopper 于 2009-11-18 16:32 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#Region ### START Koda GUI section ### Form=
TrayTip("温馨提示", "我在这里哟", 5, 1)
$settingsitem = TrayCreateMenu("设置")
Opt("TrayMenuMode", 1)
$displayitem1 = TrayCreateItem("显示", $settingsitem)
$displayitem2 = TrayCreateItem("关闭", $settingsitem)
$Form1 = GUICreate("简单记事本", 646, 473)
GUISetState()
$MenuItem3 = GUICtrlCreateMenu("文件(F)")
$MenuItem8 = GUICtrlCreateMenuItem("新建", $MenuItem3)
$MenuItem7 = GUICtrlCreateMenuItem("打开", $MenuItem3)
$MenuItem10 = GUICtrlCreateMenuItem("关闭", $MenuItem3)
$MenuItem6 = GUICtrlCreateMenuItem("保存", $MenuItem3)
$MenuItem5 = GUICtrlCreateMenuItem("退出", $MenuItem3)
$MenuItem2 = GUICtrlCreateMenu("编辑(E)")
$MenuItem12 = GUICtrlCreateMenu("格式(O)")
$MenuItem11 = GUICtrlCreateMenuItem("字体", $MenuItem2)
$MenuItem1 = GUICtrlCreateMenu("查看(V)")
$MenuItem4 = GUICtrlCreateMenu("帮助(H)")
$MenuItem9 = GUICtrlCreateMenuItem("关于", $MenuItem4)
$MenuItem13 = GUICtrlCreateMenuItem("自动换行", $MenuItem12)
$Edit1 = GUICtrlCreateEdit("", 1, 2, 644, 430, $WS_VSCROLL)
GUICtrlSetState($Edit1, $GUI_HIDE)
GUICtrlSetData(-1, "")
;$Button1 = GUICtrlCreateButton("关闭", 200, 392, 105, 49, $WS_GROUP)
;$Button2 = GUICtrlCreateButton("清空", 328, 392, 113, 49, $WS_GROUP)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
Dim $StatusBar1_PartsWidth[3] = [50, 100, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "", 2)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 20)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$temp = 1
$panduan = 0
While 1
$nMsg = GUIGetMsg()
$tMsg = TrayGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE)
;Case $Button1
;GUICtrlSetData($Edit1, "hello~world" & $temp & @CRLF, 1)
;$temp += 1
;Case $Button2
;GUICtrlSetData($Edit1, "")
Case $MenuItem5
Exit
Case $MenuItem7
$fileurl = FileOpenDialog("选择文件", "c:\", "文本文件 (*.txt;*.ini;*.log)")
$openfile = FileOpen($fileurl, 0)
$conts = FileRead($openfile)
GUICtrlSetState($Edit1, $GUI_SHOW)
GUICtrlSetData($Edit1, $conts)
FileClose($openfile)
$panduan = 1
Case $MenuItem8
GUICtrlSetState($Edit1, $GUI_SHOW)
Case $MenuItem9
MsgBox(64, "关于", "QQ")
Case $MenuItem6
If $panduan = 1 Then
$openfile2 = FileOpen($fileurl, 2)
$contssave = GUICtrlRead($Edit1)
FileWrite($openfile2, $contssave)
FileClose($openfile2)
$panduan = 0
Else
$fileurl = FileSaveDialog("选择存储目录", @AutoItExe& "\", "文本文件 (*.txt;*.ini;*.log)", 3, "未命名.txt")
$openfile2 = FileOpen($fileurl, 2)
$contssave = GUICtrlRead($Edit1)
FileWrite($openfile2, $contssave)
FileClose($openfile2)
EndIf
Case $MenuItem10
GUICtrlSetData($Edit1, "")
GUICtrlSetState($Edit1, $GUI_HIDE)
Case $MenuItem11
GUICtrlSetFont($Edit1, 9, 400, 2, "新宋体") ; 斜体字
case $MenuItem13
GUICtrlSetStyle($Edit1,-1)
EndSwitch
Switch $tMsg
Case $displayitem1
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00080000)
GUISetState(@SW_SHOW)
Case $displayitem2
Exit
EndSwitch
WEnd |
|