Jump to content

Change colour of _GDIPlus_GraphicsDrawString

Recommended Posts

I'm using _GDIPlus_GraphicsDrawString to draw text on a bitmap image which works fine but I can't get it to draw the text in any other colour than black.

How can I change the colour of text drawn with this function.

Link to post
Share on other sites

I don't know what @UEZ or @jpm think about what follows, but OP's question is an interesting feature and it could be done in a simple way, by adding an optional parameter to Func _GDIPlus_GraphicsDrawString() . Here is the beginning of the original function as found in GDIPlus.au3

Func _GDIPlus_GraphicsDrawString($hGraphics, $sString, $nX, $nY, $sFont = "Arial", $fSize = 10, $iFormat = 0)
    Local $hBrush = _GDIPlus_BrushCreateSolid()
EndFunc   ;==>_GDIPlus_GraphicsDrawString

If you just change the 1st line in the function, for example :

Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)

Then running the example from the help file would display "Hello world" in red.
If you guys think it's correct, then it could be a possible feature to add to AutoIt

Edit: in that case, allowing the Default keyword for parameters preceding the last one could also be user friendly

Edited by pixelsearch
Link to post
Share on other sites

I would say you should use


instead to get the feature you want. 😉

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites

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...