Adapt matlab app size to windows resoultion and scaling

126 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Melinda Toth-Zubairi
Melinda Toth-Zubairi am 27 Aug. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by