How do you enable a GUI to adjust to fit screens of varying resolution

I created a GUI in Guide and I want my GUI to adjust to fit screens of different varying resolution, because my application will be used on different computers.
Is there a way to allow this guide? If so, how?
or
Is there a few lines of code need to enable this feature? If so, where can i find examples of the code?
Thank you in advance,
Cordelle

 採用された回答

Tom
Tom 2013 年 7 月 1 日

1 投票

In GUIDE, under Tools -> GUI options you can specify the resizing of the figure, including your own resize function.
You might also want to consider this FEX Submission.

7 件のコメント

Cordelle
Cordelle 2013 年 7 月 1 日
the GUI option "resize" allows me to adjust the size of the GUI. However my objective was to have the GUI adjust itself with respect to the size of the screen it is used on. In addidtion, the "resize" option adjusts the size of the GUI, however, it doesn't adjust the size/position of the buttons, tables and etc in the GUI.
Do you have any idea of how I can solve this problem?
Tom
Tom 2013 年 7 月 1 日
You get find the screen size from the root:
get(0,'ScreenSize')
I thought the buttons etc. should resize automatically, but it sounds like you'll have to use the ResizeFcn to do it manually: setting all of the controls/ panels to normalised units should help for this.
Cordelle
Cordelle 2013 年 7 月 1 日
How would i utilize get(0, 'ScreenSize')?
For clarification, go to property inspector in guide and set all the units to normalized?
Tom
Tom 2013 年 7 月 1 日
try running it in the command line - it will give you the screen size in pixels. Yes, or you can change them when the GUI loads, for example in the OpeingFcn:
set(findobj(handles.figure1),'Units','Normalized')
Cordelle
Cordelle 2013 年 7 月 1 日
編集済み: Cordelle 2013 年 7 月 1 日
Once im given the screen size, how can i use the info to allow my GUI to adjust to any screen itself?
Tom
Tom 2013 年 7 月 1 日
You can set the figure size to the screensize:
set(handles.figure1,'Units','Pixels','Position',get(0,'ScreenSize'))
And from there resize the objects of the GUI.
Praneeti Mitra
Praneeti Mitra 2021 年 4 月 21 日
Can someone help me with the same problem?

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

その他の回答 (1 件)

Panu Pratumnopharat
Panu Pratumnopharat 2017 年 1 月 1 日
編集済み: Walter Roberson 2017 年 1 月 1 日

0 投票

GUI = figure('Color',[0.941 0.941 0.941],...
'Name','HAWTsimulator',...
'NumberTitle','off',...
'MenuBar','none',...
'Unit','normalized',...
'Position',[0 0 1 1],...
'outerposition',[0 0 1 1]);

カテゴリ

ヘルプ センター および File Exchange で Data Exploration についてさらに検索

質問済み:

2013 年 7 月 1 日

コメント済み:

2021 年 4 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by