How can I get my GUI to resize properly on different displays?

17 views (last 30 days)
I created a GUI that does not seem to re-size correctly on different computer displays. The GUI fig is defined in GUIDE and I have checked to see that all of the units are "character" in the property inspector and in the GUI options I also have the Resize behavior set to: Non-resizable.
I am using the following code to get the screen resolution and define the window size and position, but the figure does not hold the same size on different displays and will chop off information.
What approach do I need to take to get this to work? How should I modify the code below or do I have settings wrong in the GUIDE Fig?
Thanks Ian
SC = get(0, 'ScreenSize')
MaxMonitorX = SC(3)
MaxMonitorY = SC(4)
% Set the figure window size values
MainFigScale = 1; % Change this value to adjust the figure size
MaxWindowX = round(MaxMonitorX*MainFigScale)*1200/MaxMonitorX*1.02;
MaxWindowY = round(MaxMonitorY*MainFigScale)*800/MaxMonitorY;
TabOffset = 0; % This value offsets the tabs inside the figure.
ButtonHeight = 40;
PanelWidth = MaxWindowX-2*TabOffset+4;
PanelHeight = MaxWindowY-ButtonHeight-2*TabOffset;
ButtonWidth = round((PanelWidth-NumberOfTabs)/NumberOfTabs);
% Set the color varables.
White = [1 1 1]; % White - Selected tab color
BGColor = .9*White; % Light Grey - Background color
% Create a figure for the tabs
hTabFig = fig; %Use GUIDE Fig
set(hTabFig, 'Position',[ MaxWindowX/30, MaxWindowY/20, MaxWindowX/6, MaxWindowY/16]);

Accepted Answer

Image Analyst
Image Analyst on 14 Apr 2015
Don't set it to non-resizable but set the units of everything to 'normalized'.
  1 Comment
Ian
Ian on 15 Apr 2015
That was it changed the units to "normalized" and set the GUI options to "proportional" in GUIDE. I already had all the other pages in the GUI that were hard coded with units set to "normalized". Thank You for your help. Ian

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!