Resizing GUI and components to keep original layout.

How do I automatically resize my GUI for different window screen resolutions? I've read other answers but they only say to make the GUI full screen or some other size relating to the size of the whole screen. However, my static texts do not resize even though I have them checked as normalized. How can I make sure everything resizes automatically to account for any screen changes?

Respuestas (1)

Image Analyst
Image Analyst el 3 de Sept. de 2017
In GUIDE, make sure all your components have a Units property of 'normalized'. Then, in your opening code, if you have Windows, call MaximizeFigureWindow (attached). If you don't have Windows, use this code that makes the window larger but doesn't technically "maximize" it.
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);
% Get rid of tool bar and pulldown menus that are along top of figure.
% set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
% set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')

6 comentarios

awezmm
awezmm el 3 de Sept. de 2017
This doesn't enlarge the static text proportionally or the button labels. How would I do that?
That is controlled by the setting in GUIDE for fontsize. The font size does not scale with window size since it's controlled by the operating system. No windows program does, that I know of, so MATLAB is not unique in that regard.
awezmm
awezmm el 3 de Sept. de 2017
Editada: awezmm el 3 de Sept. de 2017
Is there a way I can set the code programatically. Like if the the size of textbox increases by 5 then set font size to increase by 10? How would i assign a handle to see if the size of the box increased? Is there a set function for text size?
Yes. Just set it. For example:
handles.btnGo.FontSize = 20;
how to do when i use MATLAB Appdesigner to create app?
I think it uses app instead of handles. So try
app.btnGo.FontSize = 20;

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Preguntada:

el 3 de Sept. de 2017

Comentada:

el 15 de Abr. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by