#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <String.au3>
Opt('MustDeclareVars', 1)
Global Const $width = 800
Global Const $height = 600
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $hwnd, $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2,$brush1
Global $brush_color, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
$hwnd = GUICreate("gdi+绘字", $width, $height, -1, -1, 0, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
;~ _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
$ScreenDc = _WinAPI_GetDC($hWnd)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
; _WinAPI_UpdateLayeredWindow parameters
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $width)
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 255)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
GUISetState()
$brush1 = _GDIPlus_BrushCreateSolid(0x96ffffff)
;~ _GDIPlus_BrushSetSolidColor($brush1, 0x96ffffff)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily1 = _GDIPlus_FontFamilyCreate("黑体")
;~ $hFont1 = _GDIPlus_FontCreate($hFamily1,500, 1)
For $i=10 To 200 Step 20
$hFont1 = _GDIPlus_FontCreate($hFamily1,$i,0, 2)
$tLayout = _GDIPlus_RectFCreate(0, $i*2)
;~ _GDIPlus_GraphicsClear($backbuffer, 0x00000000)
_GDIPlus_GraphicsDrawStringEx($backbuffer, $i, $hFont1, $tLayout, $hFormat,$brush1)
next
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
_WinAPI_SelectObject($dc, $gdibitmap)
_WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
Do
Until GUIGetMsg()= -3
_WinAPI_DeleteDC($dc)
_WinAPI_ReleaseDC($hWnd, $ScreenDc)
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_FontFamilyDispose($hFamily2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
GUIDelete($hwnd)
字体小时(大概100以下),文字下方有明显的黑色背景,字体大点的话没黑色背影