pusofalse 发表于 2009-1-10 05:44:02

求助,rebar控件被重绘

创建了一个最大/小化/可调整大小的窗口,并在上面创建了一个REBAR控件,但是当窗口被调整时,rebar中band的位置就发生了改变,帮助中几个例子也有此问题,但没有说明解决此问题的方法。试图在自定义函数wm_size中重新调整但没有找到类似于autosize的rebar函数,请问怎样设置rebar在窗口被调整时自动保留其原有位置或者不被重绘。谢!
#include <GuiRebar.au3>
#include <GuiToolbar.au3>
#include <GuiImageList.au3>

Global const $wm_size=0x0005
Global const $ccs_top = 0x1
Global const $ccs_noresize = 0x4
Global const $ccs_noparentalign = 0x8
Global const $ws_sizebox = 0x40000
Global const $ws_maximizebox = 0x10000
Global const $ws_minimizebox = 0x20000

Opt("GuiOnEventMode", 1)

$winStyle = BitOr($ws_sizebox, $ws_maximizebox, $ws_minimizebox)
$hGui = GuiCreate("rebar test", 400, 300, -1, -1, $winStyle)

Local $Icon = , $Img
$Img = _GuiImageList_Create(16, 16, 5, 3)
For $ele In $Icon
        _GuiImageList_AddIcon($Img, "shell32.dll", $ele)
Next

Local Enum $IdNew = 1000, $IdOpen, $IdSave, $IdExit
Local $string = ["new", "open", "save", "exit"], $toolbar, $str
$toolbarStyle = BitOr($tbstyle_flat, $ccs_noresize, $ccs_noparentalign)
$toolbar = _GuiCtrlToolbar_Create($hGui, $toolbarStyle)
_GuiCtrlToolbar_SetImageList($toolbar, $Img)
For $d = 0 to 3
        $str[$d] = _GuiCtrlToolbar_AddString($toolbar, $string[$d])
        _GuiCtrlToolbar_AddButton($toolbar, Eval("Id"&$string[$d]), $d, $str[$d])
Next

$progress = GuiCtrlCreateProgress(0, 0, 90, 20)
$hProgress = GuiCtrlGetHandle($progress)

$rebarStyle = BitOr($ccs_top, $rbs_varheight, $rbs_fixedorder)
$rebar = _GuiCtrlRebar_Create($hGui, $rebarStyle)

_GuiCtrlRebar_AddToolbarBand($rebar, $toolbar)
_GuiCtrlRebar_AddBand($rebar, $hProgress, 100, 130, "Progress:")

GuiSetState()
GuiSetOnEvent(-3, "_exit", $hGui)
GuiRegisterMsg($wm_size, "wm_size")

While 1
        sleep(2000)
WEnd

Func _exit()
        Exit(0)
EndFunc        ;==>_exit()

Func wm_size($hwnd, $message, $wParam, $iParam)
        msgBox(0, '', 'resizing')
EndFunc        ;==>wm_size()


aa147147 发表于 2009-10-14 15:30:17

$winStyle = BitOr($WS_CLIPCHILDREN,$ws_sizebox, $ws_maximizebox, $ws_minimizebox)

kn007 发表于 2009-10-14 16:21:09

不懂,只知道楼上的不符合要求应该

破帽遮颜 发表于 2009-10-14 16:21:32

本帖最后由 破帽遮颜 于 2009-10-14 16:22 编辑

$progress = GuiCtrlCreateProgress(0, 0, 90, 20)
GUICtrlSetResizing(-1, 512 + 32 + 2 + 1)

不知道这样行不行??如果需要不改变位置,512 + 32 + 2 + 1改成768试试看
页: [1]
查看完整版本: 求助,rebar控件被重绘