Is there a way to have a GUI in guide auto-adjust to fit current screen resolution, and/or can I hard-set the resolution of the interface at a specific value?

1 件のコメント

Trinh Nam
Trinh Nam 2020 年 2 月 18 日
You can Right Click on Guide (Open Fig file), Left Click to "GUI Options", Choose "Proportional" of Resize behavior

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2016 年 6 月 28 日

0 投票

You can set the figure Units property to be Normalized, and set the Position property to be [0 0 1 1] if you want full screen. Or, if more appropriate, you can set the Units to Pixels or to 'cm' and use the appropriate values for Position.

7 件のコメント

Eric Gilkey
Eric Gilkey 2016 年 6 月 28 日
Hi Walter,
I'm very inexperienced with guide, so pardon my ignorance, but I'm not sure that this is what I'm looking for. When editing the figure, setting units to "Normalized" seems to only fill up the gray space I happen to have available at the time; this doesn't fill up the entire screen when I run the .m. I'm wanting to allow the program to auto-scale the figure when it's opened by different users on different computers. Am I misinterpreting your answer?
Thank you
Walter Roberson
Walter Roberson 2016 年 6 月 28 日
Eric Gilkey
Eric Gilkey 2016 年 6 月 29 日
編集済み: Eric Gilkey 2016 年 6 月 29 日
I should clarify: I want to auto-scale the entire interface.
Edit: I tried using the following
set(gcf, 'units', 'normalized', 'position', [0 0 1 1])
But this doesn't fill up the entire screen, nor does it scale everything in the interface according to the window size.
Adam
Adam 2016 年 6 月 29 日
Generally a UI scaled like this looks very ugly as you end up with massive buttons and sliders and other stuff that you ideally don't want to be scaled (doing what Image Analyst says should achieve this though).
If you want to do some more carefully defined scaling you would usually have to do it in the GUI's SizeChangedFcn. For example I have had UIs which contain an axes and then a panel of ui controls. When I resize I want the axes to resize, but not the panel of UI controls so I program this in such a way as to resize only the axes to fill the available space while the ui components remain of fixed size.
Image Analyst
Image Analyst 2016 年 6 月 29 日
You can mix and match units. Some can be normalized and others in pixels, though that may lead to overlap. It's best to have all normalized and then tweak the size of the control to leave the lower left corner in the same place but you just adjust the width and height on a customized control-by-control basis if you want.
Walter Roberson
Walter Roberson 2016 年 6 月 29 日
True full screen requires operating-system specific calls. Using position [0 0 1 1] covers all of the area except title bars and docks and trays -- all of the area that the window manager normally gives programs. To go beyond that you need one of the utilities like Image Analyst posted or such as https://www.mathworks.com/matlabcentral/fileexchange/11112-fullscreen
I have to agree with Adam that just scaling everything usually ends up looking bad. It is also problematic when you get to screens with different aspect ratios.
What I ended up doing was writing a series of utilities to do programmatic layout.
(Unfortunately, I cannot release them as-is, for copyright reasons, and I never got around to re-writing them.)
Eric Gilkey
Eric Gilkey 2016 年 6 月 30 日
Thanks for the answers everyone. Changing the unit type seems to do the trick well enough.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 6 月 29 日

0 投票

You have to set all the 'units' properties of all the controls to 'normalized'. To do this, type control-a to select everything in the GUI, then set the units property to 'normalized'. This may/will not set the units of controls inside a groupbox panel so you may have to set those separately.
Then, in the OpeningFcn() of your GUI, call the attached MaximizeFigureWindow (if you're using Microsoft Windows) to maximize the window. This truly maximizes it, unlike setting the position property of the GUI. Setting the Position property always seems to leave the window slightly misaligned anyway - bottom left is never at 0,0 like it should be.

2 件のコメント

Eric Gilkey
Eric Gilkey 2016 年 6 月 30 日
Thanks Image Analyst
Hamin Chang
Hamin Chang 2017 年 8 月 15 日
Thank you so much!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by