DaRam Posted April 28, 2008 Share Posted April 28, 2008 Hi:I need some help with Splash Screen when displayed as an About Screen.When I add Labels on Layered Window, they never appear.Think I have to create a Child Window and use the SetLayeredWindowAttributes API (?) - If so some help would be appreciated.Also, Should I just include the functions/code in Splash.Au3 instead of include(ing) it? SplashTest.Au3 is the Main GUI, Which calls the 2 Functions in (the attached) Splash.Au3Splash.png is the Graphic File used by Splash.Au3.SplashTest.Au3expandcollapse popup#NoTrayIcon #Include "Splash.Au3" Local $SplashShown $SplashShown = True DisplaySplash() If @error Then $SplashShown = False Sleep(1000) $guiMain = GUICreate("Main GUI", 300, 400, -1, -1) $MenuFile = GUICtrlCreateMenu("&File") $mnuFileExit = GUICtrlCreateMenuItem("E&xit", $MenuFile) $MenuHelp = GUICtrlCreateMenu("&Help") $mnuHelp = GUICtrlCreateMenuItem("&Help", $MenuHelp) $mnuAbout = GUICtrlCreateMenuItem("&About", $MenuHelp) GUISetState() Sleep(1000) If $SplashShown Then DismissSplash() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $mnuFileExit ExitLoop Case $mnuAbout $NormalLabelTxt = "Some Caption" $HotLabelTxt = "Hot Caption" DisplaySplash() If @error Then $SplashShown = False If $SplashShown Then While 1 If Check4KbdOrMousePress() Then ExitLoop WEnd DismissSplash() EndIf EndSwitch Wend Func Check4KbdOrMousePress() Local $Keycodes = StringSplit("01|02|04|05|06" & _ "|08|09|0C|0D|10|11|12|13|14|1B|20|21|22" & _ "|23|24|25|26|27|28|29|2A|2B|2C|2D|2E|30" & _ "|31|32|33|34|35|36|37|38|39|41|42|43|44" & _ "|45|46|47|48|49|4A|4B|4C|4D|4E|4F|50|51" & _ "|52|53|54|55|56|57|58|59|5A|5B|5C|60|61" & _ "|62|63|64|65|66|67|68|69|6A|6B|6C|6D|6E" & _ "|6F|70|71|72|73|74|75|76|77|78|79|7A|7B" & _ "|90|91|A0|A1|A2|A3|A4|A5", "|") For $i in $Keycodes If _IsPressed(String($i)) Then Return 1 Next Return 0 EndFuncSplash.Au3 Link to comment Share on other sites More sharing options...
DaRam Posted April 29, 2008 Author Share Posted April 29, 2008 Bump Link to comment Share on other sites More sharing options...
Malkey Posted April 29, 2008 Share Posted April 29, 2008 (edited) BumpTry replacing the exiting SetBitmap() function with this one. expandcollapse popup; Func SetBitmap($hGUI, $hImage, $iOpacity) Const $AC_SRC_ALPHA = 1 Const $ULW_ALPHA = 2 Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend local $hBrush, $hFormat, $hFamily, $hFont, $tLayout,$hGraphic $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $hGraphic = _GDIPlus_GraphicsCreateFromHDC ($hMemDC) $hBrush = _GDIPlus_BrushCreateSolid (0xffFA0C0A) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ("Arial") $hFont = _GDIPlus_FontCreate ($hFamily, 32, 1) $tLayout = _GDIPlus_RectFCreate ( 100, 200, 350, 50 ) _GDIPlus_GraphicsDrawStringEx ($hGraphic, $HotLabelTxt, $hFont, $tLayout, $hFormat, $hBrush) $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) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose ($hBrush) EndFunc ;==>SetBitmap ; With this I did get Hot Caption in red across the image when the About button is pressed. If it works, You have some unnecessary code you can delete. Edited April 29, 2008 by Malkey Link to comment Share on other sites More sharing options...
DaRam Posted April 29, 2008 Author Share Posted April 29, 2008 Thanks Malkey, but I can't seem to make it work [i did have to change WinAPI_DeleteDC($hMemDC) to _WinAPI_DeleteDC($hMemDC)]Here are the Modified Scripts...SplashTest.Au3:expandcollapse popup#NoTrayIcon #Include "Splash.Au3" Local $SplashShown $SplashShown = True DisplaySplash() If @error Then $SplashShown = False Sleep(1000) $guiMain = GUICreate("Main GUI", 300, 400, -1, -1) $MenuFile = GUICtrlCreateMenu("&File") $mnuFileExit = GUICtrlCreateMenuItem("E&xit", $MenuFile) $MenuHelp = GUICtrlCreateMenu("&Help") $mnuHelp = GUICtrlCreateMenuItem("&Help", $MenuHelp) $mnuAbout = GUICtrlCreateMenuItem("&About", $MenuHelp) GUISetState() Sleep(1000) If $SplashShown Then DismissSplash() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $mnuFileExit ExitLoop Case $mnuAbout $HotLabelTxt = "About Splash" DisplaySplash() If @error Then $SplashShown = False If $SplashShown Then While 1 If Check4KbdOrMousePress() Then ExitLoop WEnd DismissSplash() EndIf EndSwitch Wend Func Check4KbdOrMousePress() Local $Keycodes = StringSplit("01|02|04|05|06" & _ "|08|09|0C|0D|10|11|12|13|14|1B|20|21|22" & _ "|23|24|25|26|27|28|29|2A|2B|2C|2D|2E|30" & _ "|31|32|33|34|35|36|37|38|39|41|42|43|44" & _ "|45|46|47|48|49|4A|4B|4C|4D|4E|4F|50|51" & _ "|52|53|54|55|56|57|58|59|5A|5B|5C|60|61" & _ "|62|63|64|65|66|67|68|69|6A|6B|6C|6D|6E" & _ "|6F|70|71|72|73|74|75|76|77|78|79|7A|7B" & _ "|90|91|A0|A1|A2|A3|A4|A5", "|") For $i in $Keycodes If _IsPressed(String($i)) Then Return 1 Next Return 0 EndFuncSplash.Au3:expandcollapse popup#include <GUIConstants.au3> #Include <GDIPlus.au3> Global $SplashGUI, $hSplashImage Global $HotLabelTxt Func DisplaySplash() Local $pngSrc, $width, $height, $i ; Load PNG file as GDI bitmap $pngSrc = @WorkingDir & "\Splash.png" If NOT FileExists($pngSrc) Then SetError(1) Return EndIf _GDIPlus_Startup() $hSplashImage = _GDIPlus_ImageLoadFromFile($pngSrc) ; Extract image width and height from PNG $width = _GDIPlus_ImageGetWidth($hSplashImage) $height = _GDIPlus_ImageGetHeight($hSplashImage) ; Create layered window $SplashGUI = GUICreate("", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED, $DS_MODALFRAME) SetBitmap($SplashGUI, $hSplashImage, 0) GUISetState() WinSetOnTop($SplashGUI, "", 1) ;fade in png background For $i = 0 To 255 Step 5 SetBitmap($SplashGUI, $hSplashImage, $i) Next EndFunc;==>DisplaySplash Func DismissSplash() Local $i If Not IsHWnd($SplashGUI) Then SetError(1) Return EndIf ;fade out png background For $i = 255 To 0 Step - 5 SetBitmap($SplashGUI, $hSplashImage, $i) Next ; Release resources _GDIPlus_ImageDispose($hSplashImage) _GDIPlus_Shutdown() GUIDelete($SplashGUI) EndFunc;==>DismissSplash() Func SetBitmap($hGUI, $hImage, $iOpacity) Const $AC_SRC_ALPHA = 1 Const $ULW_ALPHA = 2 Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend local $hBrush, $hFormat, $hFamily, $hFont, $tLayout,$hGraphic $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $hGraphic = _GDIPlus_GraphicsCreateFromHDC ($hMemDC) $hBrush = _GDIPlus_BrushCreateSolid (0xffFA0C0A) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ("Arial") $hFont = _GDIPlus_FontCreate ($hFamily, 32, 1) $tLayout = _GDIPlus_RectFCreate ( 100, 200, 350, 50 ) _GDIPlus_GraphicsDrawStringEx ($hGraphic, $HotLabelTxt, $hFont, $tLayout, $hFormat, $hBrush) $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) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose ($hBrush) EndFunc ;==>SetBitmapI do see the alternative you are suggesting (painting the image), which I don't see yet.But, I want to go with a transparent label on top of the background image, so I can later on have events triggered on label click or hover.Any further thoughts/suggestions? Link to comment Share on other sites More sharing options...
Malkey Posted April 29, 2008 Share Posted April 29, 2008 (edited) I do see the alternative you are suggesting (painting the image), which I don't see yet.But, I want to go with a transparent label on top of the background image, so I can later on have events triggered on label click or hover.Any further thoughts/suggestions?I just grabbed the first png file I found in my picture directory which happened to be 660x540. I got the script working.I have now gone to the other extreme and found a 50x50 png file.Initially, I suggested these two lines in the SetBitmap() function as:- $hFont = _GDIPlus_FontCreate ($hFamily, 32, 1) $tLayout = _GDIPlus_RectFCreate ( 100, 200, 350, 50 )Replace these two lines with:- $hFont = _GDIPlus_FontCreate ($hFamily, 8, 1) $tLayout = _GDIPlus_RectFCreate ( 5,5, 45, 45 )You can adjust the parameters in these functions to suit yourself.Hope this works.Edit: Just found your image. It looks very good in the script. I am blind to the advertising people put at the bottom of their posts. Try $hFont = _GDIPlus_FontCreate ($hFamily, 32, 1) $tLayout = _GDIPlus_RectFCreate ( 120, 5, 300, 40 ) Edited April 30, 2008 by Malkey Link to comment Share on other sites More sharing options...
DaRam Posted April 30, 2008 Author Share Posted April 30, 2008 Thanks again Malkey. I will try this, but would prefer to finally use a label for the reasons I posted earlier. I would have to make the same font (size) and layout (Rect) adjustments whether I use the graphic paint or label method, but the final purpose is different (click event and hover action).Do appreciate your efforts to help. Link to comment Share on other sites More sharing options...
Malkey Posted April 30, 2008 Share Posted April 30, 2008 (edited) I would have to make the same font (size) and layout (Rect) adjustments whether I use the graphic paint or label method, but the final purpose is different (click event and hover action). Do appreciate your efforts to help. Some time ago I did this function expandcollapse popup#include <GDIPlus.au3> #include <GuiConstantsEx.au3> ;Run Beta Version Includes #include <WindowsConstants.au3> #include <Misc.au3> Global Const $WM_LBUTTONDOWN = 0x0201 ; Drag Window 1 of 3 addin Global $hGui Local $nText, $init = 1, $angle = -5, $xpos = 0 Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) $nText = "AutoIt GDIPlus rotate text Example" ;Enter text to be displayed here ;CreateFloatAngleText($nText,$Left=-1,$Top=-1,$nAngle=0,$nFontName="Arial",$nFontSize=12,$iARGB=0xFFFF00FF) ; CreateFloatAngleText($nText, -130, -45, 38, -1, 70 ) ; Large text 70 ; $init = 1 allows initial flow through to display text. ; 2nd time through Do-Until loop, spaceBar or middle mouse button need to be pressed to display text. Do If _IsPressed("20") Or _IsPressed("04") Or $init = 1 Then ; SpaceBar or middle mouse button key If $init <> 1 Then GUIDelete() $init = 2 $angle = Mod($angle + 5, 360) ;$xpos += 20 CreateFloatAngleText($nText, -1, -1, $angle, -1, -1, 0) ;0 for random color; $xpos - increment X position. EndIf Sleep(250) Until _IsPressed("1B") ; ESC key ; #FUNCTION# ================================================================ ; Name...........: CreateFloatAngleText ; Description ...: Puts text on screen at any angle. ; Syntax.........: CreateFloatAngleText($nText, $Left = -1, $Top = -1, $nAngle = 0, $nFontName = "Arial", _ ; $nFontSize = 12, $iARGB = 0xFFFF00FF) ; Parameters ....: $nText - Text string to be displayed ; $Left - Approximate Top left position of text from left of screen (default = -1 ) ; $Top - Approximate Top left position of text from top of screen (default = -1 ) ; $nAngle - the angle which the text will be place. (default = 0 ) ; $nFontName - The name of the font to be used (default = "Arial" ) ; $nFontSize - The font size to be used (default = 12 ) ; $iARGB - Alpha, Red, Green and Blue color. (0=random color)(default=0xFFFF00FF) ; Return values .: 1 ; Author ........: Malkey 31/03/08 ; Modified.......: ; Remarks .......: Tested on xp 512mb mem. 1280x1024 resolution. Worked ok. ; Enter 0 for color, generates random color of text. ; Related .......: ; Link ..........; ; Example .......; Yes ; ======================================================================================== Func CreateFloatAngleText($nText, $Left = -1, $Top = -1, $nAngle = 0, $nFontName = "Arial", _ $nFontSize = 12, $iARGB = 0xFFFF00FF) Local $hWnd, $hDC, $hBitmap, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend Local $iOpacity = 200 Local $ULW_ALPHA = 2 Local $nPI = 3.1415926535897932384626433832795 Local $hGui, $hGraphic Local $GuiSize, $x, $y, $nX, $ny, $GuiWidth, $GuiHeight, $nWidth, $nHeight, $txtlen Local $hMatrix, $nXt, $nYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout ; Default values If $nAngle = "" Or $nAngle = -1 Then $nAngle = 0 If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif" If $nFontSize = "" Or $nFontSize = -1 Then $nFontSize = 12 If $iARGB = 0 Then ;Randomize ARGB color $iARGB = "0xff" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) EndIf $txtlen = StringLen($nText) $nWidth = Int($nFontSize * $txtlen * 28/ 40) ;Tweak here to de/increase text box width size $nHeight = Int(($nFontSize * 37 / 30) * (1280 / 1024)) ;Tweak here to de/increase text box height size $GuiWidth = $nWidth - Abs($nHeight * Sin($nAngle * $nPI / 180)) $GuiHeight = $nHeight + Abs($nWidth * Sin($nAngle * $nPI / 180)) $nX = $GuiWidth / 2 $ny = $GuiHeight / 2 $hGui = GUICreate("Rotate Text", $GuiWidth, $GuiHeight, $Left, $Top, 0, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ; Drag Window 2 of 3 addin GUISetState() _GDIPlus_Startup () $hWnd = _WinAPI_GetDC (0) $hDC = _WinAPI_CreateCompatibleDC ($hWnd) $hBitmap = _WinAPI_CreateCompatibleBitmap ($hWnd, $GuiWidth, $GuiHeight) ; $iWidth, $iHeight) _WinAPI_SelectObject ($hDC, $hBitmap) $hGraphic = _GDIPlus_GraphicsCreateFromHDC ($hDC) ;Rotation Matrix $hMatrix = _GDIPlus_MatrixCreate () _GDIPlus_MatrixRotate ($hMatrix, $nAngle, 1) _GDIPlus_GraphicsSetTransform ($hGraphic, $hMatrix) ;x, y are display coordinates of center of width and height of the rectanglular text box. ;x, y increment in a circular path with radius (width of text box)/2. ;Parametric equations for a circle ; and adjusts for center of text box $x = ($nWidth / 2) * Cos($nAngle * $nPI / 180) - ($nHeight / 2) * Sin($nAngle * $nPI / 180) $y = ($nWidth / 2) * Sin($nAngle * $nPI / 180) + ($nHeight / 2) * Cos($nAngle * $nPI / 180) ;Rotation of Coordinate Axes formulae ;Use $nXt, $nYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular ;text box point before rotation. (before translation of the matrix) $nXt = ($nX - $x) * Cos($nAngle * $nPI / 180) + ($ny - $y) * Sin($nAngle * $nPI / 180) $nYt = -($nX - $x) * Sin($nAngle * $nPI / 180) + ($ny - $y) * Cos($nAngle * $nPI / 180) ; Parameters for GDIPlus_GraphicsDrawStringEx() $hBrush = _GDIPlus_BrushCreateSolid ($iARGB) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ($nFontName) $hFont = _GDIPlus_FontCreate ($hFamily, $nFontSize, 1, 3) $tLayout = _GDIPlus_RectFCreate ($nXt, $nYt, $nWidth, $nHeight) _GDIPlus_GraphicsDrawStringEx ($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush) ; Parameters for _WinAPI_UpdateLayeredWindow $tSize = DllStructCreate ($tagSIZE) $pSize = DllStructGetPtr ($tSize) DllStructSetData ($tSize, "X", $GuiWidth) DllStructSetData ($tSize, "Y", $GuiHeight) $tSource = DllStructCreate ($tagPOINT) $pSource = DllStructGetPtr ($tSource) $tBlend = DllStructCreate ($tagBLENDFUNCTION) $pBlend = DllStructGetPtr ($tBlend) DllStructSetData ($tBlend, "Alpha", $iOpacity) DllStructSetData ($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow ($hGui, $hWnd, 0, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA) ; Clean up resources _GDIPlus_MatrixDispose ($hMatrix) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose ($hBrush) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_ReleaseDC (0, $hWnd) _WinAPI_DeleteObject ($hBitmap) _WinAPI_DeleteDC ($hDC) _GDIPlus_Shutdown () return 1 EndFunc ;==>CreateFloatTextAngle ; ================================================================= ; Drag Window 3 of 3 addin ; ================================================================= Func _WinMove($hWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($hWnd), 32) Then Return $GUI_RUNDEFMSG ;DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) DllCall("user32.dll", "int", "SendMessage", "hWnd", $hWnd, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0) EndFunc ;==>_WinMove If you delete all the stuff that supports the function, and just use the CreateFloatAngleText() function, this is probably what you want. Edit: Using this script, the space bar rotates the text. Edited April 30, 2008 by Malkey Link to comment Share on other sites More sharing options...
losh Posted May 11, 2008 Share Posted May 11, 2008 hi! @ Malkey: nice script!! but what do i need, if i simply want to display a label "embedded in desktop"? (without rotating and random colors) Link to comment Share on other sites More sharing options...
Malkey Posted May 11, 2008 Share Posted May 11, 2008 hi! @ Malkey: nice script!! but what do i need, if i simply want to display a label "embedded in desktop"? (without rotating and random colors)Here is GDIPlus desktop text Function with less extras. expandcollapse popup#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "Quit") Func Quit() Exit EndFunc ;==>Quit CreateFloatText("All you need is _ _ _ _ _ _ _ _.") ;or CreateFloatText("Where to go to from here.", 100, 10, "Arial" , 25, 0xFFFF00ff) While 1 Sleep(20) WEnd Func CreateFloatText($nText, $Left = -1, $Top = -1, $nFontName = "Arial", _ $nFontSize = 12, $iARGB = 0xFFFF0000) Local $hWnd, $hDC, $hBitmap, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend Local $iOpacity = 255 Local $ULW_ALPHA = 2 Local $hGui, $hGraphic, $GuiWidth = 500, $GuiHeight = 100 Local $hBrush, $hFormat, $hFamily, $hFont, $tLayout $txtlen = StringLen($nText) $GuiWidth = Int($nFontSize * $txtlen * 37/ 40) ;Tweak here to de/increase text box width size $GuiHeight = Int(($nFontSize * 37 / 30) * (17 / 9)) ;Tweak here to de/increase text box height size $hGui = GUICreate("Text", $GuiWidth, $GuiHeight, $Left, $Top, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState() _GDIPlus_Startup () $hWnd = _WinAPI_GetDC (0) $hDC = _WinAPI_CreateCompatibleDC ($hWnd) $hBitmap = _WinAPI_CreateCompatibleBitmap ($hWnd, $GuiWidth, $GuiHeight) _WinAPI_SelectObject ($hDC, $hBitmap) $hGraphic = _GDIPlus_GraphicsCreateFromHDC ($hDC) ; Parameters for GDIPlus_GraphicsDrawStringEx() $hBrush = _GDIPlus_BrushCreateSolid ($iARGB) $hFormat = _GDIPlus_StringFormatCreate () $hFamily = _GDIPlus_FontFamilyCreate ($nFontName) $hFont = _GDIPlus_FontCreate ($hFamily, $nFontSize, 1, 3) $tLayout = _GDIPlus_RectFCreate ($Left, $Top, $GuiWidth, $GuiHeight) $aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $nText, $hFont, $tLayout, $hFormat) $rectWidth = DllStructGetData($aInfo[0], "Width") $rectHeight = DllStructGetData($aInfo[0], "Height") _GDIPlus_GraphicsDrawStringEx ($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush) ; Parameters for _WinAPI_UpdateLayeredWindow $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $GuiWidth) DllStructSetData($tSize, "Y", $GuiHeight) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow ($hGui, $hWnd, 0, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA) ; Clean up resources _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_BrushDispose ($hBrush) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_ReleaseDC (0, $hWnd) _WinAPI_DeleteObject ($hBitmap) _WinAPI_DeleteDC ($hDC) _GDIPlus_Shutdown () Return 1 EndFunc ;==>CreateFloatText Hope this helps. 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