Consistent GUI screen sizing on laptop and monitor

조회 수: 29 (최근 30일)
Mason Dyess
Mason Dyess 2019년 8월 6일
댓글: Rik 2019년 8월 20일
Hi, so I have a GUI that I mainly work on at the internship I have, where I use a 1920x1080 resolution monitor. I verified that Matlab was using this same resolution by doing the get(0,'screensize') command. However, I went to work on it at home on my laptop, which is also 1920x1080 resolution, and the layout for the GUI is all messed up. Furthemore, when I did get(0,'screensize'), it says the resolution is 1280x720 even though I'm positive my laptop's screen is 1920x1080 resolution. How do I fix this so that my GUI works on both my laptop and the monitor I work on? Is there some command I can do on my laptop where I can change the Matlab resolution to 1920x1080? Does it have something to do with the fact that my laptops screen is physically smaller than the monitor screen (13'' vs roughly 24'')?
  댓글 수: 8
Mason Dyess
Mason Dyess 2019년 8월 20일
@Rik Display scaling was exactly the issue, mine was set to 150% and when I changed it back to 100%, it worked. Thanks for the helpful response! One more thing though, so when I disable display scaling unfortunately it causes my screen to look pretty zoomed out- having the display scaling is ideal. With this in mind, is there any easy way to scale my gui to work when the display is scaled?
Rik
Rik 2019년 8월 20일
I don't know how you could solve this, but I suggest you contact Mathworks support to see if they consider this a bug.

댓글을 달려면 로그인하십시오.

채택된 답변

Chidvi Modala
Chidvi Modala 2019년 8월 14일
You can set all the 'units' properties of all the controls to 'normalized'. You can also set the Position property to [0 0 1 1], if you want full screen.
  댓글 수: 6
Rik
Rik 2019년 8월 14일
@Adam, actually, that misses a point. That presuposes that all sizes are correct, which is apparently not the case. So Mason would need to run this code on a computer where the sizes turn out correct, and then use the result to adapt the code to generate the GUI with normalized units.
(although to be fair, it isn't entirely clear to me why the layout would break, instead of everything just being scaled down and all proportions staying correct)
Mason Dyess
Mason Dyess 2019년 8월 20일
Thanks guys, switching to normalized units was pretty helpful for auto-resizing. However, the major issue that was causing me problems was display scaling, so thanks to @Rik for suggesting that as the potential cause.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Chidvi Modala
Chidvi Modala 2019년 8월 13일
I am assuming that you are using GUIDE to build your GUI.
  댓글 수: 1
Mason Dyess
Mason Dyess 2019년 8월 14일
Hi, I actually didn't use GUIDE at all to build my GUI. I instead programmatically built it using commands like uicontrol.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by