回复 1# doshowyam
给个参考代码,看看合不合用:
#include <GUIConstants.au3>
#include <windowsconstants.au3>
#include <editconstants.au3>
#include <sendmessage.au3>
#include <ButtonConstants.au3>
#include <winapi.au3>
#region - GUI Create
$gui1 = GUICreate("Parent GUI", 800, 500, 100, 100)
GUICtrlCreatePic(@ScriptDir&"\2.jpg", 0, 50, 800, 450)
GUICtrlSetState(-1,$GUI_DISABLE)
$button1=GUICtrlCreateButton("ok",0,0,50,50,$BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 22)
$button2=GUICtrlCreateButton("ok",80,0,50,50,$BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 23)
$button3=GUICtrlCreateButton("ok",160,0,50,50,$BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 24)
$button4=GUICtrlCreateButton("ok",240,0,50,50,$BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 25)
$button5=GUICtrlCreateButton("ok",320,0,50,50,$BS_ICON)
GUICtrlSetImage(-1, "shell32.dll", 26)
GUISetState()
$gui2 = GUICreate("child", 800, 448, 103, 180, $WS_POPUP, BitOR(0x2000000, $WS_EX_LAYERED), $gui1);$WS_EX_COMPOSITED
$ed1 = GUICtrlCreateEdit("", -2, -2, 804, 452, BitOR($ES_READONLY, $ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetBkColor(-1, 0xABCDEF)
GUICtrlSetFont(-1, 12, 800, 1, "Arail")
;GUICtrlSetColor(-1, 0xffff00)
GUICtrlSetCursor(-1,2)
$text = FileRead(@ScriptFullPath)
GUICtrlSetData(-1, $text)
_WinAPI_SetLayeredWindowAttributes($gui2, 0xABCDEF, 255)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMANDER")
GUIRegisterMsg($WM_MOVE, "shift_child")
#endregion
_SendMessage($gui1, $WM_NCACTIVATE, 1)
#region - GUI SelectLoop
controlsend($gui2,"",$ed1,"^{HOME}")
While 1
$extMsg = GUIGetMsg(1)
$msg = $extMsg[0]
Switch $extMsg[1]
Case $gui1
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg =$button1
$file=FileOpenDialog("",@ScriptDir&"","所有文件(*.*) |文本文档(*.txt)" )
$text=FileRead($file)
GUICtrlSetData($ed1,$text)
GUICtrlSetState($ed1,$GUI_FOCUS)
;GUISwitch($gui2,$ed1)
Case $msg =$button2
GUICtrlSetFont($ed1,-1, 18, 400, 4, "mshei")
Case $msg =$button3
Case $msg =$button4
Case $msg =$button5
EndSelect
EndSwitch
WEnd
#endregion
Func shift_child($hwnd, $msg, $wparam, $lparam)
If $hwnd = $gui1 Then
Local $wp = WinGetPos($gui1)
WinMove($gui2, '', $wp[0] + 3, $wp[1] + 80)
EndIf
EndFunc ;==>shift_child
Func WM_COMMANDER($hwnd, $msg, $wparam, $lparam)
$nNotifyCode = BitShift($wparam, 16)
$nID = BitAND($wparam, 0x0000FFFF)
$hCtrl = $lparam
If $nID = $ed1 Then
If $nNotifyCode = $EN_SETFOCUS Then
_SendMessage($gui1, $WM_NCACTIVATE, 1);, 0)
Send("{HOME}")
EndIf
If $nNotifyCode = $EN_KILLFOCUS and _
wingettitle("") <> "Parent GUI" _
Then _SendMessage($gui1, $WM_NCACTIVATE, 0);, 0)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>setparentactive
|