Jump to content
Darien

How to bold part of the text in a GUI label

Recommended Posts

Darien

Hello,

 

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

Share this post


Link to post
Share on other sites
water

I do not think this is possible using pure AutoIt.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
mikell

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
JLogan3o13

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!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
Darien

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
UEZ

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
Darien

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
UEZ

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

×