gui size problem on another computer

9 visualizaciones (últimos 30 días)
outmane charrouf
outmane charrouf el 26 de Jul. de 2021
Respondida: Walter Roberson el 26 de Jul. de 2021
i creat a new interface , but when i use the gui in other comptuer , the size not change and still big .how can i solve this probleme?
Ps : i use matlab 2017
  4 comentarios
outmane charrouf
outmane charrouf el 26 de Jul. de 2021
Editada: Walter Roberson el 26 de Jul. de 2021
i don't know about controling , i put the size of gui manuelly
X=30;Y=30;L=500;H=500;
numConfig = 1
[taille,couleur] = initConfig(numConfig);
ecart=taille.ecart;
htext=taille.htext;
h=taille.h;
lbouton=taille.lbouton;
ltexte=taille.ltexte;
ledit=taille.ledit;
uicontrol('parent',h0,'Style','frame','Units','points', ...
'BackgroundColor',couleur.frame,'Tag','frameBouton', ...
'Position',[ecart ecart/2 L-2*ecart ecart]);
Jonas
Jonas el 26 de Jul. de 2021
set the size using normalized coordinates, thusbway the elements will have constant size relative to the whole monitor

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 26 de Jul. de 2021
The default Units for uicontrol Position is 'pixels'.
If you want your GUI to adapt to a different screen size, then you have two options:
  • set Units to 'normalized' and set the figure Position to fractions of the screen size, such as [0.05 0.05 .8 .8]; OR
  • continue to use 'pixels' as your Units, but calculate the number of pixels based upon the screen size
Either way, you will run into problems with text. You can set the size of a graphics object to occupy fewer pixels so that it does not look too large on a smaller screen, but humans prefer text to be about the same angular size. If you have a title that fits nicely on your first computer, then if you display it on a screen with half of the resolution, if you were to reduce the font to half of the size so that all of the text fits, then people would have trouble reading the text. Some text is about 3cm on your higher-resolution display still needs to occupy roughly 3cm on the lower resolution display even though that might be a much higher proportion of the available width.
When you use a lower resolution display, you often end up having to use text wrapping and allowing more vertical height for a section that includes text -- you pretty much end up needing to recompute the position of all of the elements. And you have to do that again if you permit the user to control the font size (or the font, for that matter.)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by