怎么建立一个白色边框的GUI?[已解决]
本帖最后由 eaglelin 于 2013-2-12 09:23 编辑怎么建立一个白色边框的GUI? 啥叫白色边框啊??? 需要无边框吗? 需要无边框吗?
魔导 发表于 2013-2-10 00:56 http://www.autoitx.com/images/common/back.gif
需要 回复 4# eaglelin
源自:http://www.autoitx.com/forum.php?mod=viewthread&tid=32915&highlight=%CE%DE%B1%DF
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_icon=D:\windows\system32\SHELL32.dll|-193
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GuiListView.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include<ie.au3>
#include <INet.au3>
#include <array.au3>
Dim $guiW = @DesktopWidth-600,$guiH = @DesktopHeight-300,$Bk_C=12
Dim $GUI_BS =
Dim $title = "//⊙简单的界面by:绿色风⊙//"
opt("GUICloseOnESC",0)
$Form1 = GUICreate($title, $guiW, $guiH, -1, -1,BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
GUISetBkColor($GUI_BS[$Bk_C])
#Region 模版 GUI顶部与低部
GUICtrlCreateLabel($title,10,4)
GUICtrlCreateGroup("", $guiW - 36 - 36-3 , -5, 16, 22)
GUICtrlSetResizing(-1, 544 + 260)
$labw = GUICtrlCreateLabel("?", $guiW - 13-18 - 36-3 , 4, 8, 10) ;帮助
GUICtrlSetResizing(-1, 544 + 260)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", $guiW - 18- 36-3, -5, 16, 22)
GUICtrlSetResizing(-1, 544 + 260)
$labS = GUICtrlCreateLabel("#", $guiW - 13- 36-3, 4, 8, 10) ;换背景色
GUICtrlSetResizing(-1, 544 + 260)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", $guiW - 18 -18-3 , -5, 16, 22)
GUICtrlSetResizing(-1, 544 + 260)
$labF = GUICtrlCreateLabel("-", $guiW - 13 - 18-3, 4, 8, 10) ;最小化
GUICtrlSetResizing(-1, 544 + 260)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", $guiW - 18-3, -5, 16, 22)
GUICtrlSetResizing(-1, 544 + 260)
$labe = GUICtrlCreateLabel("x", $guiW - 13-3, 3, 8, 10) ;关闭
GUICtrlSetResizing(-1, 544 + 260)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("",0,18,$guiW+4,2,$SS_ETCHEDHORZ);顶画一条线
GUICtrlSetResizing(-1, 544 )
GUICtrlCreateLabel("",0,$guiH-18,$guiW+4,2,$SS_ETCHEDHORZ);底部 画一条线
GUICtrlSetResizing(-1, 576)
GUICtrlCreateLabel("⊙",2,$guiH-14,14,14)
GUICtrlSetResizing(-1, 768+66)
$sow = GUICtrlCreateLabel("qq:79664738",16,$guiH-14,100,14) ;底部信息显示
GUICtrlSetResizing(-1, 768+66)
GUICtrlCreateLabel("⊙",120,$guiH-14,14,14)
GUICtrlSetResizing(-1, 768+66)
GUICtrlCreateLabel("http://tl158.taobao.com",136,$guiH-14,300,14) ;底部信息显示
GUICtrlSetResizing(-1, 768+66)
#EndRegion
Opt("GUIOnEventMode", 1)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_NCHITTEST, "_GuiMove") ;窗体移动
GUICtrlSetOnEvent($labe, "gui") ;退出
GUICtrlSetOnEvent($labF, "gui") ;最小化
GUICtrlSetOnEvent($labS, "gui") ;换背景色
GUICtrlSetOnEvent($labw, "gui") ;help
GUISetOnEvent($GUI_EVENT_CLOSE, "gui")
_RoundGUI($Form1, 0, 0, 20, 10) ;窗体圆角
While 1
Sleep(1000)
WEnd
#Region;模版 不动的
Func gui() ;窗体控件事件
Switch @GUI_CtrlId
Case $labe,$GUI_EVENT_CLOSE;退出
Exit
Case $labS ;换背景我
$Bk_C += 1
If $Bk_C = 15 Then Dim $Bk_C = 0
GUISetBkColor($GUI_BS[$Bk_C], $Form1);设置窗体的背景颜色
Case $labF ;最小化
WinSetState($Form1, "", @SW_MINIMIZE)
Case $labw ;help
MsgBox(0,"传说 中 的帮 助","还没想好写什么,"&@CRLF &"如果你觉得这个对你学习au3有参考价值:嘿!嘿!"&@crlf&"那就随机赠送几张彩票(taobaoID:VBT风哥)或者"&@crlf&"捐赠点米米(支付宝ID:13640701096)给我更好啦!!!"&@CRLF&"不过呢,没看到也没关系,反正风哥的东西都是开放的!"&@crlf&"只是最近的我来的比较少了,因为俺失业中...",15)
EndSwitch
EndFunc ;==>gui
Func _GuiMove($hWnd, $iMsg, $iwParam, $ilParam) ;窗体 缩放拉伸
Dim $winXY = 1 ; 窗口被拉伸 ,检测窗体最小尺寸 开关
$MousePos = MouseGetPos()
$nPos = WinGetPos("")
$DT = ($hWnd = $Form1 And $iMsg = $WM_NCHITTEST)
$DDx = ($MousePos < $nPos + $nPos - 8) And ($MousePos > $nPos + 8)
$DDy = ($MousePos < $nPos + $nPos - 8) And ($MousePos > $nPos + 8)
; 以上是无边框窗体移动事件的发生条件
If $DT And $DDx And $DDy Then Return $HTCAPTION ;移动
EndFunc ;==>_GuiMove
Func _RoundGUI($h_win, $i_x1, $i_y1, $i_x3, $i_y3) ;窗体圆角API
Dim $pos, $ret, $ret2
$pos = WinGetPos($h_win)
$ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos, "long", $pos, "long", $i_x3, "long", $i_y3)
If $ret Then
$ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret, "int", 1)
If $ret2 Then
Return 1
Else
Return 0
EndIf
Else
Return 0
EndIf
EndFunc ;==>_RoundGUI
#EndRegion 本帖最后由 eaglelin 于 2013-2-10 15:47 编辑
回复 5# 魔导
对不起你这个例子不是白色边框 上下可以画线左右两边没法画线 回复 6# eaglelin
魔导只是教给了你一个办法,不是让你拿来就用的. 我给你个现成的吧.
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$Form = GUICreate("Code by 疯子 QQ14958306", 631, 444, 354, 207, BitOR($WS_SYSMENU,$WS_POPUP,$DS_MODALFRAME))
GUISetOnEvent($GUI_EVENT_CLOSE, "FormClose")
$Label1 = GUICtrlCreateLabel("Label1", 0, 0, 596, 20, $SS_WHITERECT)
$Label2 = GUICtrlCreateLabel("Label1", 0, 16, 12, 425, $SS_WHITERECT)
$Label3 = GUICtrlCreateLabel("Label1", 0, 431, 630, 12, $SS_WHITERECT)
$Label4 = GUICtrlCreateLabel("Label1", 618, 20, 12, 415, $SS_WHITERECT)
$btnMin = GUICtrlCreateLabel("━", 593, 0, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor (-1, 0)
GUICtrlSetOnEvent(-1, "btnMinClick")
$btnClose = GUICtrlCreateLabel("╋", 610, 0, 20, 20, $SS_CENTER)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetCursor (-1, 0)
GUICtrlSetOnEvent(-1, "FormClose")
$Label7 = GUICtrlCreateLabel("魔导只是教给了你一个办法,不是让你拿来就用的.", 40, 160, 548, 49)
GUICtrlSetFont(-1, 18, 400, 0, "华文琥珀")
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
Func btnMinClick()
WinSetState($Form,"",@SW_MINIMIZE)
EndFunc
Func FormClose()
Exit
EndFunc
回复 7# lanfengc
谢谢楼上 我知道了 高手真多, 学习了 谢谢楼上 我知道了 谢谢楼上 我知道了
页:
[1]