|
看了某某写的一个好看的GUI, 测试过后发现是拖过的,而不是定点移动过去的,请问怎么解决。?
看看他的源码!
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 635, 442, 226, 157, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$Tab1 = GUICtrlCreateTab(1, 24, 633, 417)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("test1")
$TabSheet2 = GUICtrlCreateTabItem("test2")
$TabSheet3 = GUICtrlCreateTabItem("test3")
$TabSheet4 = GUICtrlCreateTabItem("test4")
$TabSheet5 = GUICtrlCreateTabItem("test5")
GUICtrlCreateTabItem("")
$Label1 = GUICtrlCreateLabel("XXXX网维工具:)", 2, 1, 560, 20,$SS_CENTERIMAGE);$SS_CENTERIMAGE垂直居中,$ss_center水平居中显示
GUICtrlSetColor(-1, 0xFFFFFF)
;~ GUICtrlSetBkColor(-1, 0xabcdef)
$Label2 = GUICtrlCreateLabel("X", 620, 4, 18, 18)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label3 = GUICtrlCreateLabel("+", 592, 4, 18, 18)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label4 = GUICtrlCreateLabel("-", 564, 4, 18, 18)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label3
If BitAND(WinGetState($Form1), 32) Then
GUISetState(@SW_RESTORE, $Form1)
Else
GUISetState(@SW_MAXIMIZE, $Form1)
EndIf
Case $Label4
GUISetState(@SW_MINIMIZE, $Form1)
Case $Label2
MsgBox(0, "提示", "程序将退出!!!")
Exit
Case $GUI_EVENT_PRIMARYDOWN
mouseCHK()
EndSwitch
WEnd
Func mouseCHK()
$MS = GUIGetCursorInfo($Form1)
If $MS[4] = $Label1 Then move()
EndFunc ;==>mouseCHK
Func move()
Local $PosDiff[2], $MousePos, $WinPos
$MousePos = MouseGetPos()
$WinPos = WinGetPos($Form1, "")
$PosDiff[0] = $WinPos[0] - $MousePos[0]
$PosDiff[1] = $WinPos[1] - $MousePos[1]
While _IsPressed("01", DllOpen("user32.dll"))
$MousePos = MouseGetPos()
WinMove($Form1, "", $MousePos[0] + $PosDiff[0], $MousePos[1] + $PosDiff[1])
Sleep(10)
WEnd
EndFunc ;==>move[/au3]
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|