回复 4# kood481748
Vista或WIN7下,开启AERO试用.
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WINAPIex.au3>
#include <sendmessage.au3>
#include <GuiEdit.au3>
#Include <Date.au3>
#include <GDIPlus.au3>
HotKeySet("ESC", "_Exit")
If Not _WinAPI_DwmIsCompositionEnabled() Then
MsgBox(16, 'Error', '桌面窗口管理(DWM)不可用'&@CRLF&'退出示例!')
Exit
EndIf
$alpha=_WinAPI_DwmGetColorizationColor( )
$CtrlBkColor="0X"&Hex(BitAND($alpha,0xFFFFFF),6)
$alpha="0X"&Hex($alpha)
Global $Jpg = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\msoobe.jpg'
_GDIPlus_Startup()
$hImage1 = _GDIPlus_ImageLoadFromFile($Jpg)
$hBitmap1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)
$hHBITMAP = _WinAPI_CreateBitmap(430, 252, 1, 32)
$hCDC = _WinAPI_CreateCompatibleDC(0)
_WinAPI_SelectObject($hCDC, $hHBITMAP)
$hGraphic = _GDIPlus_GraphicsCreateFromHDC($hCDC)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, 430, 252)
$hFontFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFontFamily, 24)
$hBrush = _GDIPlus_BrushCreateSolid(0xffFFc0c0)
$tLayout = _GDIPlus_RectFCreate(30, 200)
_GDIPlus_GraphicsDrawStringEx($hGraphic, "This is a Font", $hFont, $tLayout, 0, $hBrush)
_WinAPI_DeleteObject($hImage)
_GDIPlus_GraphicsDispose($hGraphic)
_WinAPI_DeleteDC($hCDC)
$form1 = GUICreate("abc", 430, 252, -1, -1, -1, $WS_EX_LAYERED);_GDIPlus_ImageGetWidth($hImage1), _GDIPlus_ImageGetHeight($hImage1), -1, -1, $WS_POPUP, $WS_EX_LAYERED)
_WinAPI_UpdateLayeredWindowEx($form1, $hHBITMAP, 200,1)
_GDIPlus_ImageDispose($hImage1)
_WinAPI_DeleteObject($hBitmap1)
_GDIPlus_Shutdown()
GUISetState()
$pos1=WinGetPos($form1,"")
$hGUI = GUICreate("Test", 430, 180, $pos1[0]+5, $pos1[1]+30, 0x80000000, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, 0x02000000),$form1)
local $lable = GUICtrlCreateLabel("", 2, 2, 250, 25)
GUICtrlSetFont(-1, 12, 800, 1, '微软雅黑',3)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1,-2)
$Edit1 = GUICtrlCreateEdit("这里输入", 2, 25, 400, 148, $ES_AUTOVSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
GUICtrlSetBkColor(-1, $CtrlBkColor)
GUICtrlSetFont(-1, 24, 800, 1, '微软雅黑',3)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState()
GUISetBkColor($CtrlBkColor)
_WinAPI_SetLayeredWindowAttributes($hGUI, $alpha, 255,True)
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
GUIRegisterMsg($WM_SIZE, "WM_MOVE")
While 1
$nt = _NowCalc()
If $nt <> GUICtrlRead($lable) Then GUICtrlSetData($lable, $nt)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
$XY2 = WinGetPos($Form1)
WinMove($hGUI, "", $XY2[0]+5, $XY2[1]+30)
EndFunc
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
Switch $hWnd
Case $form1
Switch $iMsg
Case $WM_NCHITTEST
Return $HTCAPTION
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NCHITTEST
|