#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#Include <APIConstants.au3>
#Include <GUITab.au3>
#Include <WinAPIEx.au3>
#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
;Const $tMARGINS
;Const $tagMARGINS
_Main()
Func _Main()
Global $From1, $hBrush, $hFormat, $hFamily, $hFont, $tLayout;,$tMARGINS,$tagMARGINS
; Create GUI
$From1 = GUICreate("GDI+", 400, 300)
GUISetBkColor(0x0)
Const $tMARGINS = DllStructCreate("int;int;int;int")
DllStructSetData($tMARGINS, 1, -1)
_WinAPI_DwmExtendFrameIntoClientArea($From1, $tMARGINS)
GUISetState()
; Draw a string
_GDIPlus_Startup ()
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($From1)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF000000)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("微软雅黑")
$hFont = _GDIPlus_FontCreate ($hFamily, 30, 0,2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 600, 70)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "系统版本:Windows 7", $hFont, $tLayout, $hFormat, $hBrush)
; GUIRegisterMsg(0x0f, "WM_PAINT")
GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")
; Loop until user exits
Do
Until GUIGetMsg() = -3
; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main
Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
;$hGraphic = _GDIPlus_GraphicsCreateFromHWND($From1)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "系统版本:Windows 7", $hFont, $tLayout, $hFormat, $hBrush)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_PAINT
由于困难较多,折腾了一小时才弄出来,有很多没用的费代码,大虾们见谅