Adapt matlab app size to windows resoultion and scaling
조회 수: 53 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!