Effacer les filtres
Effacer les filtres

change color in uilable

8 vues (au cours des 30 derniers jours)
TheDice
TheDice le 15 Avr 2021
Modifié(e) : Adam Danz le 15 Avr 2021
Hello can someone tell me how to change the color of only a part of the text?
app.c = uilabel('Parent',app.Panel,'Position',[5,50,105,25],'Text',([char(9723) 'measurement ' '15' ': -X']));

Réponse acceptée

Adam Danz
Adam Danz le 15 Avr 2021
Modifié(e) : Adam Danz le 15 Avr 2021
The FontColor property of uilabel affects the entire label.
There is no built-in method of coloring parts of labels.
As a workaround, you could contiguously position several labels containing parts of the full label and set the colors of each partial-label accordingly. You'd likely need to use a fixed width font to get the spacing right but even with a fixed width font, this will be tricky. To set the FontName to your systems default fixed width font see this answer.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by