orbs Posted August 1 Posted August 1 how to create a label with the text fading from left to right, so at the end of the label, the text is barely visible, like so: this image is a mockup i made in PowerPoint, by putting a gradient transparency rectangle over a normal text box. perhaps this technique is applicable in AutoIt? graphics is not my forte. thanks for any advice! Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Nine Posted Tuesday at 10:00 PM Posted Tuesday at 10:00 PM (edited) Here one way : ; From Nine #include <GDIPlus.au3> #include <GUIConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() _GDIPlus_Startup() Local $hGUI = GUICreate("Example", 400, 400) GUISetState() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) Local $hBrush = _GDIPlus_LineBrushCreate(50, 200, 320, 200, 0xFF000000, 0xFFFFFFFF) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate("Arial") Local $hFont = _GDIPlus_FontCreate($hFamily, 28, 2) Local $tLayout = _GDIPlus_RectFCreate(80, 100, 320, 40) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, "AutoIt Rulez !", $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphic, "AutoIt Rulez !", $hFont, $aInfo[0], $hFormat, $hBrush) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Edited Tuesday at 10:05 PM by Nine spudw2k and ioa747 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
orbs Posted Wednesday at 04:19 PM Author Posted Wednesday at 04:19 PM (edited) thank you, that looks nice! i'm now trying to understand the process. is that a "graphic" control that occupies the entire GUI? i'm asking because if i try to set a background color to the GUI, it does not show: GUISetBkColor($COLOR_YELLOW) ; ^^ not visible. the graphic object takes up the entire GUI? Edited Wednesday at 04:19 PM by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Nine Posted Wednesday at 06:15 PM Posted Wednesday at 06:15 PM 1 hour ago, orbs said: is that a "graphic" control that occupies the entire GUI? Yes it is just an example. I made it like that to simplify the code. To color the background, replace the line with yellow color : _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFF00) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
orbs Posted yesterday at 10:07 AM Author Posted yesterday at 10:07 AM ok, so how do i make it more label-like? meaning, for start, can i specify coordinates and size, rather than let it occupy the entire GUI? also, does it have a control id? can i make it clickable, resizeable, transparent background, etc? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Nine Posted yesterday at 11:06 AM Posted yesterday at 11:06 AM (edited) You will need to learn GDI+. The more you want the more complex it will become. Good luck. ps. you can use the hwnd of a label instead of the hwnd of the GUI. Edited yesterday at 11:26 AM by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
orbs Posted yesterday at 01:01 PM Author Posted yesterday at 01:01 PM (edited) 1 hour ago, Nine said: ps. you can use the hwnd of a label instead of the hwnd of the GUI. so i created a label, got its handle, and tried to use it, but nothing is displayed: expandcollapse popup; From Nine #include <GDIPlus.au3> #include <GUIConstants.au3> #include <ColorConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() _GDIPlus_Startup() Local $hGUI = GUICreate("Example", 420, 420) GUISetState() ; create a label and use it instead of the entire GUI Local $gLabel = GUICtrlCreateLabel('', 10, 10, 400, 400) Local $hLabel = GUICtrlGetHandle($gLabel) Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hLabel) _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) Local $hBrush = _GDIPlus_LineBrushCreate(50, 200, 320, 200, 0xFF000000, 0xFFFFFFFF) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate("Arial") Local $hFont = _GDIPlus_FontCreate($hFamily, 28, 2) Local $tLayout = _GDIPlus_RectFCreate(80, 100, 320, 40) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, "AutoIt Rulez !", $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphic, "AutoIt Rulez !", $hFont, $aInfo[0], $hFormat, $hBrush) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example am i missing something obvious here? _GDIPlus_GraphicsCreateFromHWND($hLabel) returns a valid handle, no @error. Edited yesterday at 01:03 PM by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Nine Posted yesterday at 01:10 PM Posted yesterday at 01:10 PM (edited) Try this version : expandcollapse popup; From Nine #include <WinAPIDiag.au3> #include <GDIPlus.au3> #include <GUIConstants.au3> ; Blend - Fade - Text Opt("MustDeclareVars", True) Example() Func Example() _GDIPlus_Startup() Local $hGUI = GUICreate("Example", 400, 400) GUISetBkColor(0xFFFF00) Local $idLabel = GUICtrlCreateLabel("", 75, 20, 250, 40) Local $hLabel = GUICtrlGetHandle($idLabel) GUISetState() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hLabel) Local $hBrush = _GDIPlus_LineBrushCreate(0, 20, 250, 20, 0xFF606060, 0xFFFFFFFF) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate("Arial") Local $hFont = _GDIPlus_FontCreate($hFamily, 28, 2) Local $tLayout = _GDIPlus_RectFCreate(0, 0, 250, 40) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, "AutoIt Rulez !", $hFont, $tLayout, $hFormat) ;_WinAPI_DisplayStruct($aInfo[0], $tagGDIPRECTF) _GDIPlus_GraphicsDrawStringEx($hGraphic, "AutoIt Rulez !", $hFont, $aInfo[0], $hFormat, $hBrush) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_RESTORE _GDIPlus_GraphicsDrawStringEx($hGraphic, "AutoIt Rulez !", $hFont, $aInfo[0], $hFormat, $hBrush) Case $idLabel ConsoleWrite("Label was clicked" & @CRLF) EndSwitch WEnd _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Edited yesterday at 01:11 PM by Nine WildByDesign and ioa747 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
orbs Posted yesterday at 03:02 PM Author Posted yesterday at 03:02 PM so the thing is that the line GUISetState() should be after the creation of the label! interesting, i never noticed it made any difference... thank you. i'll keep studying this. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
UEZ Posted yesterday at 03:31 PM Posted yesterday at 03:31 PM Here my fast hack: expandcollapse popup;Coded by UEZ build 2025-08-10 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Global $hGUI = GUICreate("Example", 420, 420) GUISetBkColor(0xFFFFFF, $hGUI) Global $iLabel1 = GUICtrlCreateLabel("This is a default text.", 10, 10, 300, 100) GUICtrlSetFont(-1, 18, 400, 0, "Arial", 5) Global $iLabel2 = GUICtrlCreatePic("", 10, 100, 300, 100) GUISetState() _GDIPlus_BitmapCreateFadedText($iLabel2, "This is an enhanced text.") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _GDIPlus_BitmapCreateFadedText($iControl, $sText, $sFont = "Arial", $fFontSize = 18, $iStartColor = 0xFF808080, $iEndColor = 0x1F0000F0, $iGradientMode = 0) _GDIPlus_Startup() Local $hStringFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize, 0) Local $aStrDim = _MeasureString($sText, $hFont, $hStringFormat, $hFamily) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($aStrDim[4], $aStrDim[5]) Local $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsSetTextRenderingHint($hCanvas, 4) Local $tRECTF = _GDIPlus_RectFCreate(0, 0, $aStrDim[4], $aStrDim[5]) Local $hBrush = _GDIPlus_LineBrushCreateFromRect($tRECTF, $iStartColor, $iEndColor, $iGradientMode) _GDIPlus_LineBrushSetGammaCorrection($hBrush, True) Local $tLayout = _GDIPlus_RectFCreate(0, 0, $aStrDim[4], $aStrDim[5]) _GDIPlus_GraphicsDrawStringEx($hCanvas, $sText, $hFont, $tLayout, $hStringFormat, $hBrush) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($iControl, 0x0172, 0, $hHBitmap)) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_Shutdown() EndFunc Func _MeasureString($sString, $hFont, $hFormat, $hFamily, $iStyle = 0) Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC(_WinAPI_GetDC(0)) Local $tLayout = _GDIPlus_RectFCreate() Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat) Local $aRanges[2][2] = [[1]] $aRanges[1][1] = StringLen($sString) _GDIPlus_StringFormatSetMeasurableCharacterRanges($hFormat, $aRanges) Local $aRegion = _GDIPlus_GraphicsMeasureCharacterRanges($hGraphics, $sString, $hFont, $aInfo[0], $hFormat) Local $aBounds = _GDIPlus_RegionGetBounds($aRegion[1], $hGraphics) _GDIPlus_RegionDispose($aRegion[1]) Local $iFontHeight = _GDIPlus_FontGetHeight($hFont, $hGraphics) Local $iLineSpacing = _GDIPlus_FontFamilyGetLineSpacing($hFamily, $iStyle) Local $iAscent = $iFontHeight / $iLineSpacing * _GDIPlus_FontFamilyGetCellAscent($hFamily, $iStyle) Local $iDescent = $iFontHeight / $iLineSpacing * _GDIPlus_FontFamilyGetCellDescent($hFamily, $iStyle) _GDIPlus_GraphicsDispose($hGraphics) Local $aDim[9] $aDim[0] = $aBounds[0] $aDim[1] = $aBounds[1] $aDim[2] = $aBounds[2] $aDim[3] = $aBounds[3] $aDim[4] = DllStructGetData($aInfo[0], "Width") $aDim[5] = DllStructGetData($aInfo[0], "Height") $aDim[6] = $iFontHeight $aDim[7] = $iAscent $aDim[8] = $iDescent Return $aDim EndFunc ;==>_MeasureString ioa747 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
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