Adapt matlab app size to windows resoultion and scaling

조회 수: 53 (최근 30일)
Linus Olofsson
Linus Olofsson 2018년 11월 26일
답변: Melinda Toth-Zubairi 2019년 8월 27일
I am having a probleam creating a matlab app for windows that needs to be able to run propperly for machines using different monitors - more precisely at different resolutions, aspect ratios, and windows scalings.
As I understand 'UI Figures' for apps, they can only be given a size by a set number of pixles, and you have to get e.g. screen size and adapt your app size accordingly by using e.g.
screenSize = get(groot,'ScreenSize');
screenWidth = screenSize(3);
screenHeight = screenSize(4);
left = screenWidth*0.1;
bottom = screenHeight*0.1;
width = screenWidth*0.8;
height = screenHeight*0.8;
drawnow;
app.UIFigure.Position = [left bottom width height];
In the above code snippet 'get(groot,'ScreenSize');' seems to get my actual screen resolution of 3440x1440p (ultra-wide) which does not include my windows scaling of 125% scaling, which results in an effective screen resolution of 2752 x 1152 (according to what is my screen resolution). The result is an app sized to fit my 3440x1440p moitot, which leavs most of the UI Figure outside of my "actual" screen of 2752x1152p.
How can I adapt my UIFigure to fit any monitor, no matter the resolution and scaling?
Thanks!
Linus.

채택된 답변

Melinda Toth-Zubairi
Melinda Toth-Zubairi 2019년 8월 27일
Starting in R2019a, MATLAB App Designer offers Apps with Auto-Reflow from the App Designer Start Page. The 2-panel and 3-panel app types are preconfigured to automatically resize and reflow in response to changes in screen size. You can use Apps with Auto-Reflow if you want to avoid writing complex resize logic.
Refer to Apps with Auto-Reflow in the MATLAB documentation for more information.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by