Change font size of every components in uifigure(app designer) by following the uifigures's size

28 vues (au cours des 30 derniers jours)
I've created several uifigures by app designer.
And now I am trying to change the font sizes of every components (ex) Label, tabel, textbox etc... following the uifigure's window size.
I mean if the uifigure size is increased then font sizes are also increased, if uifigure is decreased then also decreased.
But it was answered for figure which was created from GUIDE not App Designer so when I tried, the command
h = findall(gcf, '-property', 'fontsize')
This made a new figure not found current uifigure's property.
So I am wondering there's any other solution which can solve my problem.
Well, if it's hard to do it in app designer, then is it possible to convert uifigure into figure not breaking the file?

Réponse acceptée

Jae Heon Kim
Jae Heon Kim le 12 Fév 2020
Don't mind people!
I've figured out!
For app designer,
I coded like this!
app.UIFigure.Position(3)
app.h = findobj(app.UIFigure, '-property', 'FontSize');
app.hFontSize = cell2mat(get(app.h,'FontSize'));
position = app.UIFigure.Position;
widthF = position(3);
newFontSize = double(widthF) * app.hFontSize / 1463.0;
set(app.h,{'FontSize'}, num2cell(newFontSize));
  4 commentaires
Luca Re
Luca Re le 14 Juin 2023
hi, you use: app.h
why?
h is not a app's field

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop uifigure-Based Apps dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by