I solved by writing this code to my startupFcn
set(0,'units','pixels');
Pix_SS = get(0,'screensize');
k_vert=Pix_SS(4)/1080;
k_hor=Pix_SS(3)/1920;
%k_vert=0.75;
%k_hor=0.6;
uisize = app.UIFigure.Position;
screenWidth = uisize(3);
screenHeight = uisize(4);
left = uisize(1);
bottom = uisize(2);
width = screenWidth*k_hor;
height = screenHeight*k_vert;
k_font=(k_hor+k_vert)/2;
drawnow;
comp=app.UIFigure.Children;
app.UIFigure.Position = [left bottom width height];
assignin('base', 'pos', app.UIFigure.Position);
assignin('base', 'compp', app.UIFigure.Children);
for i=1:numel(comp)
app.UIFigure.Children(i).Position(3)=comp(i).Position(3)*k_hor;
app.UIFigure.Children(i).Position(4)=comp(i).Position(4)*k_vert;
app.UIFigure.Children(i).Position(1)=comp(i).Position(1)*k_hor;
app.UIFigure.Children(i).Position(2)=comp(i).Position(2)*k_vert;
try
a{i} = comp(i).FontSize;
catch
warning('This object does not have font option. Assigning a value of 0.');
a{i} = 0;
end
if a{i}~=0
app.UIFigure.Children(i).FontSize=comp(i).FontSize*k_font;
end
end
3 Comments
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/328317-how-can-i-specify-the-way-components-resize-automatically-in-app-designer#comment_490432
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/328317-how-can-i-specify-the-way-components-resize-automatically-in-app-designer#comment_490432
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/328317-how-can-i-specify-the-way-components-resize-automatically-in-app-designer#comment_692444
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/328317-how-can-i-specify-the-way-components-resize-automatically-in-app-designer#comment_692444
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/328317-how-can-i-specify-the-way-components-resize-automatically-in-app-designer#comment_823854
Direct link to this comment
https://fr.mathworks.com/matlabcentral/answers/328317-how-can-i-specify-the-way-components-resize-automatically-in-app-designer#comment_823854
Sign in to comment.