gui size problem on another computer

8 visualizzazioni (ultimi 30 giorni)
outmane charrouf
outmane charrouf il 26 Lug 2021
Risposto: Walter Roberson il 26 Lug 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 Commenti
outmane charrouf
outmane charrouf il 26 Lug 2021
Modificato: Walter Roberson il 26 Lug 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 il 26 Lug 2021
set the size using normalized coordinates, thusbway the elements will have constant size relative to the whole monitor

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 26 Lug 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.)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by