How can I lock resolution on images?

3 ビュー (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2019 年 10 月 6 日
コメント済み: Walter Roberson 2019 年 10 月 7 日
Hi
Let me give an example. I designed a GUI figure using GUIDE putting some elements upon it such as sliders, buttons, etc. This Figure was created in a small screen of 12 and 15" inches accordingly.
The pixel positions of the elements were set by that resolution. When I tried to project the same figure on a desktop screen with 22" or 25" size, I saw the sliders buttons and text frames displaced having their original position on screen that couldn't fit on a bigger screen with different resolution.
Is there a Matlab command to lock the positions of those elements according to their figure position no matter the screen size they are going to be displaced?
Thanks
Looking forward to your help.

回答 (2 件)

Image Analyst
Image Analyst 2019 年 10 月 6 日
Try setting the units property of all the controls to "pixels" if you want them at the same pixel position regardless of how many pixels are on different screens.
Try setting the units property of all the controls to "normalized" if you want them at the same relative position (percentage of way across or down the screen) regardless of how many pixels are on different screens.
  5 件のコメント
Rik
Rik 2019 年 10 月 7 日
You should be looking in the properties section of the graphics elements. Here is the explanation for figure. The idea is that the lower left corner is (0,0) and upper-right is (1,1), so you can essentially define the positions as percentages of the container. The container for undocked figures is the screen, for buttons it is either the figure, or a uipanel.
For a discussion about if GUIDE is the best tool for the job, I would invite you to have a read here.
Walter Roberson
Walter Roberson 2019 年 10 月 7 日
On the smaller monitor, open the figure. Execute the command
set( findall(groot, '-property', 'Units'), 'Units', 'normalized')
Save the figure again. It can now be opened on the larger monitor and everything should scale.

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


Walter Roberson
Walter Roberson 2019 年 10 月 6 日
There is a tension between elements of a GUI that is difficult to resolve by just resizing.
Graphs can mostly be resized arbitrarily as long as the aspect ratio is preserved. There is a lower limit below which not all of the detail can be discerned, but humans are pretty good at understanding that "space was limited" and mostly be forgiving as long as the general trend is still visible.
Text, however, gets unreadable below a point, and "looks wrong" if it is too large for the situation.
The proportions that are accepted for graphs are not the same proportions that are accepted for text.
Meanwhile, the sizes that are accepted for some of the user interface elements such as scroll bars sit within a narrow physical range, and do not scale well.
The result of all of this is that mostly you have to let the UI elements sit around a certain physical size without scaling, and that you probably want to constrain how large text will get, whereas graphs can scale up.
In particular, you probably want to re-flow text when you change the proportions of the container rather than scale it up proportionally. And if you define the size of a particular section of a ui as being "just large enough to comfortably fit this text" then you end up moving pieces of the interface around as you resize, and you start to have to develop rules such as "This element is variable in size to fit the current font size representation of this string, and this other element should be just to the right of it and the same height". You start to develop a "layout" instead of fixed positions.
Layouts are beyond the scope of GUIDE. App Designer starts to provide some layout tools.
  2 件のコメント
Stelios Fanourakis
Stelios Fanourakis 2019 年 10 月 7 日
Yes. you got what I am trying to do. Have the graphs and texts rescaled propotionally based on the rescaling of the main figure they are placed on. Is there a way to do it in GUIDE?? I don't know how to use AppDesigner
Walter Roberson
Walter Roberson 2019 年 10 月 7 日
Have the graphs and texts rescaled propotionally based on the rescaling of the main figure they are placed on.
My experience with this topic is that rescaling everything proportionally will look bad.

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by