- Character width = width of the letter x.
- Character height = distance between the baselines of two lines of text.
How can I make my GUI fit with any screen resolution and size?
    6 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Khalil Ishaq
 le 8 Déc 2016
  
    
    
    
    
    Modifié(e) : Walter Roberson
      
      
 le 8 Déc 2016
            I am using 'character' as a unit for all the objects in my gui. I opened it once in another computer and it was messy. Is there any way I can make it fit on any screen?
0 commentaires
Réponse acceptée
  Walter Roberson
      
      
 le 8 Déc 2016
        
      Modifié(e) : Walter Roberson
      
      
 le 8 Déc 2016
  
      You can design everything using normalized coordinates instead of characters. As you move to other systems, the size of objects (including text) will shrink or expand. You might still have difficulty if the new system has a different aspect ratio for displays.
You can continue to design using characters, but in the CreateFcn of your figure, you can adjust the root default font property: https://www.mathworks.com/help/matlab/ref/figure-properties.html#property_Units
"These units are based on the default uicontrol font of the graphics root object:
To access the default uicontrol font, use get(groot,'defaultuicontrolFontName') or set(groot,'defaultuicontrolFontName')."
I notice, though, that this refers only to font name and not to font size. That leads open the question of what it is actually referring to. I would recommend also experimenting with setting the defaultuicontrolFontSize .
I notice too that this Figure Properties talks about defaultuicontrolFontName instead of defaultfigureFontName. I wonder if that is an error in the documentation? I think I'll open a support case about this.
Anyhow, what I am getting at here is that what you can do in your figure CreateFcn callback is look at the available size of the screen and from there work out what size of font you need to use so that your figure that was calibrated in 'character' units will still fit on the screen; you would then set the default font name (or default font size) as appropriate so that 'character' positioning will work out.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Graphics Object Properties dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

