找回密码
 加入
搜索
查看: 2923|回复: 6

[GUI管理] 请教下,如何限制CreateGUI窗体最大化尺寸?

  [复制链接]
发表于 2011-4-6 19:56:53 | 显示全部楼层 |阅读模式
比如限制最大化尺寸为800x600,谢谢。
发表于 2011-4-6 21:14:26 | 显示全部楼层
回复 1# pushad


$main_GUI = GUICreate('窗口大小限制示例 bbs.wglm.net 小A', 700, 500, -1, -1, 0x00040000+0x00020000+0x00010000, 0x00000010)
GUIRegisterMsg(36, "_SetMinMax")
GUISetState(@SW_SHOW)

Do
        $Msg = GUIGetMsg()
Until $Msg = -3

;设置窗口调整大小
Func _SetMinMax($hWnd, $iMsg, $wParam, $lParam)

        If $hWnd = $main_GUI Then

                Local $tMINMAXINFO = DllStructCreate("int;int;" & _
                                "int MaxSizeX; int MaxSizeY;" & _
                                "int MaxPositionX;int MaxPositionY;" & _
                                "int MinTrackSizeX; int MinTrackSizeY;" & _
                                "int MaxTrackSizeX; int MaxTrackSizeY", _
                                $lParam)

                DllStructSetData($tMINMAXINFO, "MinTrackSizeX", 600);设置窗口宽度最小为500
                DllStructSetData($tMINMAXINFO, "MinTrackSizeY", 500);设置窗口高度最小为500

        EndIf

EndFunc   ;==>_SetMinMax

http://bbs.wglm.net/forum-viewth ... fromuid-206031.html
发表于 2011-4-6 21:28:38 | 显示全部楼层
学习了,谢谢
 楼主| 发表于 2011-4-6 22:06:03 | 显示全部楼层
精彩的回复,谢谢,以后遇到问题先查API,总以为脚本库里所有的方法都有了。
发表于 2011-4-6 22:16:34 | 显示全部楼层

Opt("GUIOnEventMode", 1)
GUICreate("限制窗口大小示例", -1, -1, -1, -1, 0x40000)
GUISetOnEvent(-3, "GuiEvent")
GUIRegisterMsg(0x24, "WM_GETMINMAXINFO")
GUISetState()
While 1
        Sleep(100)
WEnd
Func GuiEvent()
        Switch @GUI_CtrlId
                Case -3
                        GUIDelete()
                        Exit
        EndSwitch
EndFunc   ;==>GuiEvent

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lparam)
        Local $tBuffer = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lparam)
        DllStructSetData($tBuffer, 7, 400);限制窗口的最小宽度为400
        DllStructSetData($tBuffer, 8, 250);限制窗口的最小高度为600
        DllStructSetData($tBuffer, 9, 600);限制窗口的最大宽度为600
        DllStructSetData($tBuffer, 10, 800);限制窗口的最大宽度为800
        Return "GUI_RUNDEFMSG"
EndFunc

评分

参与人数 1金钱 +30 收起 理由
hzxymkb + 30 师父真厉害!

查看全部评分

发表于 2011-4-7 20:28:39 | 显示全部楼层
学习了,很好的方法。
发表于 2011-4-11 12:17:30 | 显示全部楼层
回复 5# ceoguang


    高度好像不能限制
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-2 04:08 , Processed in 0.077084 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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