本帖最后由 kk_lee69 于 2015-3-17 23:02 编辑
如图:
父子窗口,如何限制子窗口不覆盖父窗口的工具列??限制子窗口的最大化范围??
意思即是 等同 限制 父窗口的客户区范围 不知有何办法可以处理??
#include <GuiToolbar.au3>
#include <GuiMenu.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiImageList.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
Opt("GUIOnEventMode", 1)
;Opt('GUIResizeMode', 802)
;Opt("GUICoordMode", 2)
$Debug_TB = False ; 檢查傳遞給函數的類名, 設置為True並輸出到一個控制項的控制碼,用於檢查它是否工作
Global $WinMain, $iMemo, $hToolbar, $hMenu, $ListViewm1, $TreeView, $ToolbarOn
Global $Inputf5, $Inputf6, $Inputf7, $Inputf8, $Inputf9, $Inputf10
Global Enum $Computer = 1000, $Network, $idSavea, $idOpen, $_IE, $_IEA, $_IEAB
Dim $aStrings[7]
_Main()
Func _Main()
; 創建 GUI
$WinMain = GUICreate("Toolbar", 800, 505, -1, -1, $WS_MAXIMIZE + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX + $WS_SIZEBOX)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
;$hToolbar = _GUICtrlToolbar_Create($WinMain)
;_GUICtrlToolbar_SetExtendedStyle($hToolbar, $TBSTYLE_EX_DRAWDDARROWS)
$MenuItem1 = GUICtrlCreateMenu("MenuItem1")
$MenuItem2 = GUICtrlCreateMenu("MenuItem2", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("MenuItem6", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("MenuItem3", $MenuItem2)
$MenuItem7 = GUICtrlCreateMenuItem("MenuItem7", $MenuItem3)
$MenuItem5 = GUICtrlCreateMenuItem("MenuItem5", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("MenuItem4", $MenuItem1)
$hToolbar = _GUICtrlToolbar_Create($WinMain);工具條
_GUICtrlToolbar_SetStyleCustomErase($hToolbar, True)
_GUICtrlToolbar_SetExtendedStyle($hToolbar, $TBSTYLE_EX_DRAWDDARROWS)
$hImage = _GUIImageList_Create(24, 24, 5, 3, 3)
;;_GUIImageList_AddIcon($hImage, "shell32.dll", 15, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 39, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 46, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 169, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 20, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 6, True)
_GUIImageList_AddIcon($hImage, "shell32.dll", 80, True)
_GUICtrlToolbar_SetImageList($hToolbar, $hImage)
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "客戶管理")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "生產管理")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "銷售管理")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "配件管理")
$aStrings[4] = _GUICtrlToolbar_AddString($hToolbar, "財務管理")
$aStrings[5] = _GUICtrlToolbar_AddString($hToolbar, "管理")
$aStrings[6] = _GUICtrlToolbar_AddString($hToolbar, "刷新")
; 添加按鈕
_GUICtrlToolbar_AddButton($hToolbar, $Computer, 0, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $Network, 1, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSavea, 2, $aStrings[2]);, $BTNS_WHOLEDROPDOWN)
;_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, 3, $aStrings[3]);, $BTNS_WHOLEDROPDOWN)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $_IE, 4, $aStrings[4], $BTNS_WHOLEDROPDOWN)
;_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $_IEA, 5, $aStrings[5], $BTNS_WHOLEDROPDOWN)
_GUICtrlToolbar_AddButton($hToolbar, $_IEAB, 6, $aStrings[6]);, $BTNS_WHOLEDROPDOWN)
$aSize = _GUICtrlToolbar_GetButtonSize($hToolbar)
_GUICtrlToolbar_SetButtonSize($hToolbar, $aSize[0], 60)
MemoWrite("Extended sytles: " & _GUICtrlToolbar_GetExtendedStyle($hToolbar))
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMANDD")
GUISetState(@SW_SHOW)
Global $hNew_Child = GUICreate("Child " , 300, 300, 10, 0, BitOR($GUI_SS_DEFAULT_GUI , $WS_MAXIMIZEBOX),-1,$WinMain)
_WinAPI_SetParent($hNew_Child, $WinMain)
; GUIRegisterMsg(36, "_SetMinMax")
GUISetState()
; 迴圈直到用戶退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; 寫入消息到 memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
Func _exit()
Exit
EndFunc ;==>_exit
|