找回密码
 加入
搜索
查看: 2515|回复: 7

[AU3基础] 【已解决】无边框,自己添加最大最小化按钮

  [复制链接]
发表于 2012-4-18 16:45:11 | 显示全部楼层 |阅读模式
本帖最后由 影子 于 2012-4-18 22:51 编辑

如题,请问大侠怎么弄,新手!举个例子最好,谢谢!

评分

参与人数 1金钱 +10 收起 理由
afan + 10

查看全部评分

发表于 2012-4-18 16:48:12 | 显示全部楼层
放两按钮.
事件为相应代码
 楼主| 发表于 2012-4-18 16:53:55 | 显示全部楼层

哦,初级自学,可以举例吗,谢谢

回复 2# 星雨朝霞
发表于 2012-4-18 16:59:01 | 显示全部楼层
本帖最后由 wua0550 于 2012-4-18 17:00 编辑

下面是例子
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



$hForm = GUICreate("无边筐", 404, 149, -1, -1, $WS_SYSMENU, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_TOPMOST))

$Button1 = GUICtrlCreateButton("最大化", 311, 11, 75, 23)
$Button2 = GUICtrlCreateButton("最小化", 200, 11, 75, 23)


GUISetState()
While 1
        Switch GUIGetMsg()
                Case $Button1
                        WinSetState($hForm, "", @SW_MAXIMIZE)

                Case $Button2
                        WinSetState($hForm, "", @SW_MINIMIZE)
                Case $GUI_EVENT_CLOSE
                        Exit


        EndSwitch

WEnd

评分

参与人数 1金钱 +15 收起 理由
afan + 15

查看全部评分

发表于 2012-4-18 17:01:33 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)
#Region ### START Koda GUI section ### Form=
Global $Form = GUICreate("Form1", 363, 92, 538, 188)
Global $Button1 = GUICtrlCreateButton("最小化", 80, 24, 75, 25)
Global $Button2 = GUICtrlCreateButton("最大化", 224, 24, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
        Sleep(100)
WEnd

Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
        Local Const $SC_MOVE = 0xF010
        Local Const $SC_SIZE = 0xF000
        Local Const $SC_CLOSE = 0xF060
        If $hWnd = $Form Then
                Switch BitAND($wParam, 0xFFF0)
                        Case $SC_CLOSE
                                Exit
                EndSwitch
        EndIf
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SYSCOMMAND

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
        Local $nNotifyCode = BitShift($wParam, 16)
        Local $nID = BitAND($wParam, 0x0000FFFF)
        Local $hCtrl = $lParam
        Switch $hCtrl
                Case GUICtrlGetHandle($Button1)
                        If $nNotifyCode = $BN_CLICKED Then
                                GUISetState(@SW_MINIMIZE,$Form)
                        EndIf
                Case GUICtrlGetHandle($Button2)
                        If $nNotifyCode = $BN_CLICKED Then
                                GUISetState(@SW_MAXIMIZE,$Form)
                        EndIf
        EndSwitch
EndFunc   ;==>WM_COMMAND

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2012-4-18 17:22:44 | 显示全部楼层
本帖最后由 xiehuahere 于 2012-4-18 17:24 编辑

传送门:http://www.autoitx.com/forum.php ... p;extra=&page=1

方法类似。
发表于 2012-4-18 17:22:59 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Local $Form1 = GUICreate("Form1", 623, 442, 192, 150,BitOR($WS_POPUP,$WS_CLIPSIBLINGS,$WS_SYSMENU))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
Local $Button1 = GUICtrlCreateButton('最小化', 623-75*3, 0, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
Local $Button2 = GUICtrlCreateButton('最大化', 623-75*2, 0, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
Local $Button3 = GUICtrlCreateButton('关闭', 623-75, 0, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
While 1
        Sleep(100)
WEnd
Func Button1Click()
Switch @GUI_CtrlId
        Case $Button1
                WinSetState($Form1,'',@SW_MINIMIZE)
        Case $Button2
                $State=WinGetState($Form1)
                If $State=15 Then
                        WinSetState($Form1,'',@SW_MAXIMIZE)
                Else
                        WinSetState($Form1,'',@SW_RESTORE)
                EndIf
        Case $Button3
                Exit
EndSwitch

EndFunc
Func Form1Close()
Exit
EndFunc

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2012-4-18 17:40:25 | 显示全部楼层
ls各位已经给出例子了,简单的思路,创建3个按钮,分别设置 最小化、最大化、关闭 动作。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-27 19:06 , Processed in 0.194443 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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