How may i fit the app developed in app designer in my window?
75 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(2 个)
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
0 个评论
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 个评论
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 Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!