Darien

How to bold part of the text in a GUI label

9 posts in this topic

Hello,

 

How to bold part of the text in a GUI label?

Share this post


Link to post
Share on other sites



I do not think this is possible using pure AutoIt.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It's not possible using a label . But you might use a workaround, by joining several labels, or using a richedit control instead of a label

Share this post


Link to post
Share on other sites

As @mikell mentions, I typically just use several labels:

#include <GUIConstantsEx.au3>

    $hGUI = GUICreate("Test", 300, 80)
        GUISetFont(11, 400, Default, "Arial")

    $sLabel1 = GUICtrlCreateLabel("This is the", 10, 10, 85, 30)
    $sLabel2 = GUICtrlCreateLabel("beginning", 100, 10, 87, 30)
    $sLabel3 = GUICtrlCreateLabel("of my text.", 192, 10, 85, 30)
        GUICtrlSetFont($sLabel2, 11, 600, Default, "Arial")

    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Putting together several labels would be tricky for me. How do I use richedit control?

Share this post


Link to post
Share on other sites

The help file has a very nice example under _GUICtrlRichEdit_Create


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Here the label version:

 

Edited by UEZ

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

Share this post


Link to post
Share on other sites

Very good, UEZ, but unfortunately your script does not work with texts that contain more than one line. I will try the richedit control.

Share this post


Link to post
Share on other sites

Of course there is a possibility for multi line support but you will ask also for other features such as how to change the font for each char, etc.

That means using label controls makes the life more complicated for such "simple" feature and is not designed for it. Rich Edit is much more powerful and more easy to handle such kind of requirements.


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

Share this post


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