필터 지우기
필터 지우기

How may i fit the app developed in app designer in my window?

조회 수: 81 (최근 30일)
Pietro Fiondella
Pietro Fiondella 2022년 7월 20일
댓글: Image Analyst 2022년 7월 25일
I created an app on a different computer with a greater screen , now i am tring to run it on my PC but once open it never resize properly.
What is the problem?

답변 (2개)

Kevin Holly
Kevin Holly 2022년 7월 20일
편집: Kevin Holly 2022년 7월 20일
If you want the canvas to take up the whole screen, you can edit the WindowState of the UIFigure in AppDesigner with the Component Browser found on the right panel as shown below.
Another approach, is to use a startup function. On the Editor tab in code view, select Callback. Select the app and then select StartFcn for Callback.
In the startup function, you can convert the units of the uifigure to normalized units and the adjust the position then convert back to pixels units.
function startupFcn(app)
app.UIFigure.Units = "normalized";
app.UIFigure.Position(1) = 0.3;
app.UIFigure.Position(2) = 0.3;
app.UIFigure.Units = "pixels";
end
If you want to take into consideration the different resolution ratio bewteen the x and y axes, you can get the entire screensize as shown below and make adjustments to maintain a particular rectangular shape.
function startupFcn(app)
screen = get(0,'screensize');
xres = screen(3)-screen(1);
yres = screen(4)-screen(2);
app.UIFigure.Units = 'normalized';
app.UIFigure.Position = [0.06, 0.60, 0.3*(yres/xres),0.3];
app.UIFigure.Units = "pixels";
end

Image Analyst
Image Analyst 2022년 7월 20일
On App Designer's IDE right click the top level figure name in the Component Browser panel and add a startup function.
Then at the bottom of the startupFcn function add this line of code:
app.UIFigure.WindowState = "maximized";
The app should resize to maximize on whatever screen of yours it decided to first appear on, on your current lower resolution computer.
  댓글 수: 3
Pietro Fiondella
Pietro Fiondella 2022년 7월 25일
the maximise function only set the UIfiugre full screen, in this way the image still appears as in the attahed figure, i would like to set it centered when the app is in full size
Image Analyst
Image Analyst 2022년 7월 25일
What element? When your app's main figure window is full size, what other "element" do you want to be "centered"?
I'm attaching a CenterFigure function that you may want to try.

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

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by