BrettF Posted January 10, 2009 Share Posted January 10, 2009 (edited) Okay so I'm bored and I want to create a clock. But I want it to look pretty So I used lod3n launcher as a base, to have my transparent image as a GUI. After much searching I found out how to draw the clock hands. Now the only problem? The clock hands don't appear to be drawn... My Code! CODE; Special thanks to GaryFrost for updating this to work with AutoIt v3.2.12.0! #NoTrayIcon #include <GDIPlus.au3>; this is where the magic happens, people #include <WinAPI.au3> #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> Opt("MustDeclareVars", 0) Global Const $AC_SRC_ALPHA = 1 Global Const $PI = 3.1415926535897932384626433832795 Global $LengthOfHourHand = 110 Global $LengthOfMinuteHand = 100 Global $LengthOfSecondsHand = 125 Global $midx = 150 Global $midy = 150 ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir & "\Clock.png" $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) ; Extract image width and height from PNG $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("lod3n launcher", $width, $height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) SetBitmap($GUI, $hImage, 255) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") GUISetState() $controlGui = GUICreate("ControlGUI", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI) $hPen = _GDIPlus_PenCreate() $hPen2 = _GDIPlus_PenCreate(0xFFFF0000) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI) PaintClock(@HOUR, @MIN, @SEC, $hGraphic) GUISetState() $timer = TimerInit() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case TimerDiff($timer) >= 1000 $timer = TimerInit() PaintClock(@HOUR, @MIN, @SEC, $hGraphic) EndSelect WEnd GUIDelete($controlGui) ; Release resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ; ==================================================================================================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; ==================================================================================================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func MY_WM_PAINT($hWnd, $msg, $wParam, $lParam) _WinAPI_RedrawWindow($GUI, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hImage, $hImage, 0, 0) _WinAPI_RedrawWindow($GUI, 0, 0, $RDW_VALIDATE) PaintClock(@HOUR, @MIN, @SEC, $hGraphic) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT ; ==================================================================================================== ; SetBitMap ; ==================================================================================================== Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap ; I don't like AutoIt's built in ShellExec. I'd rather do the DLL call myself. Func _ShellExecute($sCmd, $sArg = "", $sFolder = "", $rState = @SW_SHOWNORMAL) $aRet = DllCall("shell32.dll", "long", "ShellExecute", _ "hwnd", 0, _ "string", "", _ "string", $sCmd, _ "string", $sArg, _ "string", $sFolder, _ "int", $rState) If @error Then Return 0 $RetVal = $aRet[0] If $RetVal > 32 Then Return 1 Else Return 0 EndIf EndFunc ;==>_ShellExecute Func _GUICtrlStatic_SetPicture($File, $CtrlId) $hImage = _GDIPlus_ImageLoadFromFile($File) $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) GUICtrlSetImage($CtrlId, "") _SetBitmapToCtrl($CtrlId, $hBitmap2) EndFunc ;==>_GUICtrlStatic_SetPicture Func _SetBitmapToCtrl($CtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 Local $hWnd = GUICtrlGetHandle($CtrlId) If $hWnd = 0 Then Return SetError(1, 0, 0) ; set SS_BITMAP style to control Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE) If @error Then Return SetError(2, 0, 0) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(3, 0, 0) Local $oldBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(4, 0, 0) If $oldBmp[0] <> 0 Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc ;==>_SetBitmapToCtrl Func PaintClock($hour, $minute, $second, $hGraphic) $hour_x2 = $LengthOfHourHand * Cos($PI / 180 * (30 * $hour - 90)) + $midx $hour_y2 = $LengthOfHourHand * Sin($PI / 180 * (30 * $hour - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $hour_x2, $hour_y2, $hPen) ;Minute Hand: $minute_x2 = $LengthOfMinuteHand * Cos($PI / 180 * (6 * $minute - 90)) + $midx $minute_y2 = $LengthOfMinuteHand * Sin($PI / 180 * (6 * $minute - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $minute_x2, $minute_y2, $hPen) ;Seconds Hand: $second_x2 = $LengthOfSecondsHand * Cos($PI / 180 * (6 * $second - 90)) + $midx $second_y2 = $LengthOfSecondsHand * Sin($PI / 180 * (6 * $second - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $second_x2, $second_y2, $hPen2) EndFunc ;==>PaintClock Clock.png: So where am I going wrong? Many thanks, Brett Edited January 10, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
smashly Posted January 10, 2009 Share Posted January 10, 2009 (edited) Hi Bert, Here's a cheap and dirty mod of that code you posted.. With a bit more thought you could tidy the code up a lot better, but atm I just made it so memory doesn't get chewed over time (not 100% sure though.. lol) I removed some stuff and added some stuff, but it sorta worksexpandcollapse popup#NoTrayIcon #include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Opt("MustDeclareVars", 0) Global Const $AC_SRC_ALPHA = 1 Global Const $PI = 3.1415926535897932384626433832795 Global $LengthOfHourHand = 100 Global $LengthOfMinuteHand = 115 Global $LengthOfSecondsHand = 125 Global $midx = 150 Global $midy = 150 ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir & "\Clock.png" $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) ; Extract image width and height from PNG $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) $GUI = GUICreate("", $width, $height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() $hPen = _GDIPlus_PenCreate() $hPen2 = _GDIPlus_PenCreate(0xFFFF0000) $timer = TimerInit() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_Shutdown() Exit Case TimerDiff($timer) >= 1000 $timer = TimerInit() $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) AntiAlias($hGraphic, 4) PaintClock(@HOUR, @MIN, @SEC, $hGraphic) SetBitmap($GUI, $hImage, 255) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) EndSelect WEnd ; ==================================================================================================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; ==================================================================================================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST ; SetBitMap ; ==================================================================================================== Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap Func PaintClock($hour, $minute, $second, $hGraphic) $hour_x2 = $LengthOfHourHand * Cos($PI / 180 * (30 * $hour - 90)) + $midx $hour_y2 = $LengthOfHourHand * Sin($PI / 180 * (30 * $hour - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $hour_x2, $hour_y2, $hPen) ;Minute Hand: $minute_x2 = $LengthOfMinuteHand * Cos($PI / 180 * (6 * $minute - 90)) + $midx $minute_y2 = $LengthOfMinuteHand * Sin($PI / 180 * (6 * $minute - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $minute_x2, $minute_y2, $hPen) ;Seconds Hand: $second_x2 = $LengthOfSecondsHand * Cos($PI / 180 * (6 * $second - 90)) + $midx $second_y2 = $LengthOfSecondsHand * Sin($PI / 180 * (6 * $second - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $second_x2, $second_y2, $hPen2) EndFunc ;==>PaintClock Func AntiAlias($hGraphics, $iMode) Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_AntiAlias Cheers Edit: Changed the length of hour and minute hands, I think they were the wrong way round prior. Edited January 10, 2009 by smashly Link to comment Share on other sites More sharing options...
BrettF Posted January 10, 2009 Author Share Posted January 10, 2009 Thanks heaps. That is so awesome Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
smashly Posted January 10, 2009 Share Posted January 10, 2009 Your welcome, As a side note you could draw the same clock face without even using the png file just using gdi+ instead. Cheers Link to comment Share on other sites More sharing options...
smashly Posted January 10, 2009 Share Posted January 10, 2009 Here's another mod of the code you posted, no png required.expandcollapse popup#NoTrayIcon #include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Global Const $AC_SRC_ALPHA = 1 Global Const $PI = 3.1415926535897932384626433832795 Global $iWH = 300 Global $LengthOfHourHand = 80 Global $LengthOfMinuteHand = 105 Global $LengthOfSecondsHand = 110 Global $midx = $iWH/2 Global $midy = $iWH/2 ; Load PNG file as GDI bitmap _GDIPlus_Startup() $hGui = GUICreate("", $iWH, $iWH, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW )) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGui) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWH, $iWH, $hGraphic) $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) AntiAlias($hBuffer, 4) $hBrush1 = _GDIPlus_BrushCreateSolid(0x440000FF) $hPen0 = _GDIPlus_PenCreate(0xCC000000, 5) $hPen1 = _GDIPlus_PenCreate(0xFF000000, 5) $hPen2 = _GDIPlus_PenCreate(0xFF000000, 5) $hPen3 = _GDIPlus_PenCreate(0xFFFF0000, 3) $hEndCap1 = _GDIPlus_ArrowCapCreate (15, 1) _GDIPlus_PenSetCustomEndCap ($hPen1, $hEndCap1) $hEndCap2 = _GDIPlus_ArrowCapCreate (20, 1) _GDIPlus_PenSetCustomEndCap ($hPen2, $hEndCap2) $hEndCap3 = _GDIPlus_ArrowCapCreate (35, 1) _GDIPlus_PenSetCustomEndCap ($hPen3, $hEndCap3) $timer = TimerInit() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hBrush1) _GDIPlus_ArrowCapDispose($hEndCap1) _GDIPlus_ArrowCapDispose($hEndCap2) _GDIPlus_ArrowCapDispose($hEndCap3) _GDIPlus_PenDispose($hPen0) _GDIPlus_PenDispose($hPen1) _GDIPlus_PenDispose($hPen2) _GDIPlus_PenDispose($hPen3) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hBuffer) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Exit Case TimerDiff($timer) >= 1000 $timer = TimerInit() _GDIPlus_GraphicsClear($hBuffer, 0xAA) DialDraw($hBuffer, $iWH) PaintClock(@HOUR, @MIN, @SEC, $hBuffer) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWH, $iWH) SetBitmap($hGui, $hBitmap, $iWH, $iWH, 255) EndSelect WEnd Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $hGui) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func SetBitmap($hGUI, $hImage, $iW, $iH, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC($hGUI) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $iW) DllStructSetData($tSize, "Y", $iH) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap Func PaintClock($hour, $minute, $second, $hGraphic) Local $hour_x2, $hour_y2, $minute_x2, $minute_y2, $second_x2, $second_y2 $hour_x2 = $LengthOfHourHand * Cos($PI / 180 * (30 * $hour - 90)) + $midx $hour_y2 = $LengthOfHourHand * Sin($PI / 180 * (30 * $hour - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $hour_x2, $hour_y2, $hPen1) ;Minute Hand: $minute_x2 = $LengthOfMinuteHand * Cos($PI / 180 * (6 * $minute - 90)) + $midx $minute_y2 = $LengthOfMinuteHand * Sin($PI / 180 * (6 * $minute - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $minute_x2, $minute_y2, $hPen2) ;Seconds Hand: $second_x2 = $LengthOfSecondsHand * Cos($PI / 180 * (6 * $second - 90)) + $midx $second_y2 = $LengthOfSecondsHand * Sin($PI / 180 * (6 * $second - 90)) + $midy _GDIPlus_GraphicsDrawLine($hGraphic, $midx, $midy, $second_x2, $second_y2, $hPen3) _GDIPlus_GraphicsFillEllipse($hGraphic, ($iWH/2) - 5, ($iWH/2) - 5, 10, 10) _GDIPlus_GraphicsFillEllipse($hGraphic, 10, 10, 280, 280, $hBrush1) _GDIPlus_GraphicsDrawEllipse($hGraphic, 7, 7, 286, 286, $hPen0) EndFunc ;==>PaintClock Func DialDraw($hGraphic, $iSz) Local $aDial, $iI, $iN, $iX, $iY, $iRadius = 110, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Dim $aHr[61] $aHr[5] = 2 $aHr[10] = 1 $aHr[15] = 12 $aHr[20] = 11 $aHr[25] = 10 $aHr[30] = 9 $aHr[35] = 8 $aHr[40] = 7 $aHr[45] = 6 $aHr[50] = 5 $aHr[55] = 4 $aHr[60] = 3 $hBrush = _GDIPlus_BrushCreateSolid (0xFF000000) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ("Arial") $hFont = _GDIPlus_FontCreate ($hFamily, 9, 3) For $iI = 0 to 2 * $PI Step $PI / 30 $iX1 = ($iSz/2) + Cos($iI) * ($iRadius + 16) $iY1 = ($iSz/2) - Sin($iI) * ($iRadius + 16) $iX = ($iSz/2) + Cos($iI) * $iRadius $iY = ($iSz/2) - Sin($iI) * $iRadius If Mod($iN, 5) = 0 Then $tLayout = _GDIPlus_RectFCreate ($iX1-8, $iY1-8, 20, 16) _GDIPlus_GraphicsDrawStringEx ($hGraphic, $aHr[$iN], $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_GraphicsFillEllipse($hGraphic, $iX - 3, $iY - 3, 6, 6) Else _GDIPlus_GraphicsFillEllipse($hGraphic, $iX - 2, $iY - 2, 4, 4) EndIf $iN += 1 Next _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose ($hBrush) EndFunc Func AntiAlias($hGraphics, $iMode) Local $aResult $aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode) If @error Then Return SetError(@error, @extended, False) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_AntiAlias Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now