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

27 ビュー (過去 30 日間)
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?

採用された回答

Jae Heon Kim
Jae Heon Kim 2020 年 2 月 12 日
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 件のコメント
Luca Re
Luca Re 2023 年 6 月 14 日
hi, you use: app.h
why?
h is not a app's field

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by