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!