找回密码
 加入
搜索
查看: 5460|回复: 4

[GUI管理] 如何调整状态栏大小

[复制链接]
发表于 2012-7-31 18:29:35 | 显示全部楼层 |阅读模式

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
Global $aParts[2] = [750, -1]
$GUIMain = GUICreate("test", 800, 600, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, _
                $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, _
                $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))
$hStatus = _GUICtrlStatusBar_Create($GUIMain,"","",$WS_SIZEBOX)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Exit


运行以上代码鼠标移动到GUI右下角拖动GUI如何让状态栏大小随GUI 一起变化
发表于 2012-7-31 20:10:48 | 显示全部楼层
本帖最后由 xiehuahere 于 2012-7-31 21:59 编辑

回复 1# zhwu530


看看 _GUICtrlStatusBar_Resize 这个函数帮助里面的例子吧。
我帮你修改一下:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
Global $aParts[2] = [750, -1]
$GUIMain = GUICreate("test", 800, 600, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, _
                $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, _
                $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))
$hStatus = _GUICtrlStatusBar_Create($GUIMain)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Exit

; Resize the status bar when GUI size changes
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatus)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
不过,我也有一点不是十分清楚。即关于$WM_SIZE 和 $WM_SIZING 的区别:
$WM_SIZE 应该是大小改变完成了发送的,而 $WM_SIZING 是在改变过程中实时发送的吧,根据SPY++捕获的消息看来是这样,为啥处理 $WM_SIZING 不行呢?是不是 $WM_SIZING 发个不停来不及处理?
发表于 2012-7-31 21:09:42 | 显示全部楼层
顶起,这个问题我也遇到过。一直没能解决,期待
发表于 2012-7-31 22:43:36 | 显示全部楼层
看了2楼的提示改了下看达到要求没。。

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
Global $aParts[2] = [750, -1]
$GUIMain = GUICreate("test", 800, 600, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, _
                $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, _
                $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))
$hStatus = _GUICtrlStatusBar_Create($GUIMain)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Exit

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
        Local $size = WinGetPos($GUIMain)
   Local $aParts[2] = [$size[2]-50, -1]
          _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_Resize($hStatus)
    Return $GUI_RUNDEFMSG
EndFunc
发表于 2012-7-31 22:57:32 | 显示全部楼层
回复 4# 鸟人


    对的,还需要用一下 _GUICtrlStatusBar_SetParts,我漏掉了。

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-14 14:01 , Processed in 0.076981 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表