Write bold text in a textbox - guide

861 visualizaciones (últimos 30 días)
Valerio Biscione
Valerio Biscione el 12 de Jun. de 2014
Comentada: Manuela el 27 de Ag. de 2024
How to write a bold text in a textbox in guide, from the code? Is this possible?

Respuesta aceptada

per isakson
per isakson el 12 de Jun. de 2014
Editada: per isakson el 13 de Jun. de 2014
Correction:
FontWeight
light | {normal} | demi | bold
Weight of text characters. MATLAB uses this property to select a
font from those available on your particular system. Setting this
property to bold causes MATLAB to use a bold version of the font,
when it is available on your system.
Example
figure;
uicontrol( 'style', 'text', 'string', 'abcd1234', 'fontweight', 'bold' )
.
Original answer:
AFAIK: No, but see
and
  1 comentario
Valerio Biscione
Valerio Biscione el 12 de Jun. de 2014
Thank you, that actually solves my problem completely.

Iniciar sesión para comentar.

Más respuestas (2)

Image Analyst
Image Analyst el 12 de Jun. de 2014
Try this (untested)
set(handles.text1, 'FontWeight', 'Bold');
  2 comentarios
Valerio Biscione
Valerio Biscione el 12 de Jun. de 2014
Thank you, I will try it.
Manuela
Manuela el 27 de Ag. de 2024
it works fine for me!

Iniciar sesión para comentar.


Alan Meier
Alan Meier el 14 de Jul. de 2020
For me the easiest solution I found is also described in the TextBox Properties documentation page from Matlab. I just added
'FontWeight','bold'
to my annotation box. Although this is not specifically mentioned in the annotation documentation it works fine. So I ended up with the following line:
dim = [.825 .2 .8 .65];
annotation('textbox',dim,'String','boldString','FitBoxToText','on','FontSize',14,'FontWeight','bold','linestyle','none');
  1 comentario
Image Analyst
Image Analyst el 14 de Jul. de 2020
There are a lot of things you can change. They're not all explicitly spelled out in the annotation documentation but it is mentioned like this:
Each type of annotation object supports a different set of properties. For a full list of properties and descriptions for each type, see the associated property page.
So it's not mentioned explicitly -- it's there, but there's an additional click you have to do.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by