GUI窗体 展开与折叠功能怎么做?[已解决]
本帖最后由 chenzhi1210 于 2010-5-7 07:23 编辑#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 264, 383, 142)
$Button1 = GUICtrlCreateButton("展开/折叠↓↓↓", 65, 96, 251, 25)
$Group1 = GUICtrlCreateGroup("被折叠部分", 14, 128, 353, 105)
$Label1 = GUICtrlCreateLabel("折叠后,窗口高度变小,就看不到这里了!不要影响到状态栏", 38, 176, 301, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
$Group2 = GUICtrlCreateGroup("信息", 14, 8, 353, 73)
$Label2 = GUICtrlCreateLabel("折叠前界面", 150, 40, 64, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
EndSwitch
WEnd
请问点击$Button1后,$Button1的功能函数怎么写? 设置某函数记录窗口状态或者直接获取窗口状态,后调用WinMove.
我的例子请,请自己更改:
If $EditPage=1 Then
WinMove($title,"",Default,Default,Default,170)
GUICtrlSetData($ProButton2,"详细过程")
$EditPage=2
Else
WinMove($title,"",Default,Default,Default,370)
GUICtrlSetData($ProButton2,"隐藏过程")
$EditPage=1
EndIf #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 150)
$Button1 = GUICtrlCreateButton("展开", 65, 96, 251, 25)
$Group1 = GUICtrlCreateGroup("被折叠部分", 14, 128, 353, 105)
$Label1 = GUICtrlCreateLabel("折叠后,窗口高度变小,就看不到这里了!不要影响到状态栏", 38, 176, 301, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
$Group2 = GUICtrlCreateGroup("信息", 14, 8, 353, 73)
$Label2 = GUICtrlCreateLabel("折叠前界面", 150, 40, 64, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Button1) = "展开" Then
WinMove($Form1,"", Default, Default, Default , 264)
GUICtrlSetData($Button1,"折叠")
ElseIf GUICtrlRead($Button1) = "折叠" Then
WinMove($Form1,"", Default, Default,Default , 150)
GUICtrlSetData($Button1,"展开")
EndIf
EndSwitch
WEnd #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('GUIResizeMode', 802)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 150)
$Button1 = GUICtrlCreateButton("展开", 65, 96, 251, 25)
$Group1 = GUICtrlCreateGroup("被折叠部分", 14, 128, 353, 105)
$Label1 = GUICtrlCreateLabel("折叠后,窗口高度变小,就看不到这里了!不要影响到状态栏", 38, 176, 301, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
GUICtrlSetResizing($StatusBar1,64)
$Group2 = GUICtrlCreateGroup("信息", 14, 8, 353, 73)
$Label2 = GUICtrlCreateLabel("折叠前界面", 150, 40, 64, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Button1) = "展开" Then
WinMove($Form1,"", Default, Default, Default , 264)
GUICtrlSetData($Button1,"折叠")
ElseIf GUICtrlRead($Button1) = "折叠" Then
WinMove($Form1,"", Default, Default,Default , 180)
GUICtrlSetData($Button1,"展开")
EndIf
EndSwitch
WEnd以上代码,在展开或折叠时,状态栏不能根随着变化位置,不能保持定位在底部,请问怎么解决? #include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('GUIResizeMode', 802)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 381, 150)
$Button1 = GUICtrlCreateButton("展开", 65, 96, 251, 25)
$Group1 = GUICtrlCreateGroup("被折叠部分", 14, 128, 353, 105)
$Label1 = GUICtrlCreateLabel("折叠后,窗口高度变小,就看不到这里了!不要影响到状态栏", 38, 176, 301, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hStatus = _GUICtrlStatusBar_Create($Form1)
$Group2 = GUICtrlCreateGroup("信息", 14, 8, 353, 73)
$Label2 = GUICtrlCreateLabel("折叠前界面", 150, 40, 64, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
#EndRegion ### END Koda GUI section ###
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
_GUICtrlStatusBar_Resize($hStatus)
Return $GUI_RUNDEFMSG
EndFunc
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If GUICtrlRead($Button1) = "展开" Then
WinMove($Form1,"", Default, Default, Default , 264)
GUICtrlSetData($Button1,"折叠")
ElseIf GUICtrlRead($Button1) = "折叠" Then
WinMove($Form1,"", Default, Default,Default , 180)
GUICtrlSetData($Button1,"展开")
EndIf
EndSwitch
WEnd已经解决!
感谢大家的帮助! 几年不来,又学到新东西了。 刚好需要这个,谢谢谢谢 及学习了有收藏了!谢谢楼主! 又学到新东西 呵呵温习一下。。 内容找的就是这功能 不错 刚好需要 顶起~~~ 支持,学习了~~
页:
[1]