本帖最后由 shqf 于 2014-5-17 22:14 编辑
图中可见工具条没有随窗口的拉伸而拉伸,有谁知道如何解决这个问题?
脚本如下,有关工具栏的代码从帮助例子中拷贝,当窗口可拉伸时会出现此问题。系统WinXPSP3,Autoit版本3.3.9.0,后下了3.3.11.3来试问题同样存在。#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <ListViewConstants.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
$Debug_TB = False
Global $hToolbar
Global $iItem
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp
#region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\My Documents\一般窗口.kxf
$Form2 = GUICreate("窗体1", 414, 189, 295, 180,$WS_OVERLAPPEDWINDOW)
$MenuItem1 = GUICtrlCreateMenu("文件")
$MenuItem2 = GUICtrlCreateMenuItem("打开", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("退出", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenu("设置")
$MenuItem5 = GUICtrlCreateMenuItem("设置", $MenuItem4)
$MenuItem6 = GUICtrlCreateMenu("帮助")
$MenuItem7 = GUICtrlCreateMenuItem("帮助", $MenuItem6)
$MenuItem8 = GUICtrlCreateMenuItem("关于", $MenuItem6)
$hToolbar = _GUICtrlToolbar_Create($Form2, 0)
; 添加标准系统位图
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
; 添加按钮
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
$ListView1 = GUICtrlCreateListView("", 0, 36, 409, 103)
$StatusBar1 = _GUICtrlStatusBar_Create($Form2)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 25)
Local $aParts[3] = [75, 150, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $aParts)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
; 当 GUI 大小改变时重设状态栏大小
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam, $ilParam
_GUICtrlStatusBar_Resize($StatusBar1)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
|