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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by