Jump to content

Recommended Posts

Posted

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:

image.png.b1b51f8c178e65652bbb53571cae8234.png

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

 

Posted (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 by Nine
Posted (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 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

 

Posted
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)

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...