フィルターのクリア

How to reposition logos and buttons in app designer after changing screen size.

15 ビュー (過去 30 日間)
Ratanjot
Ratanjot 2023 年 2 月 13 日
コメント済み: VBBV 2023 年 2 月 15 日
I have a trial app where the logo has been placed in the bottom right corner in the preview screen size. But once I run the app and change to full screen, the logo is no longer in the bottom right corner but rather in the middle of the screen. How can I have it so that all images, button, labels are in the relative same location of the screen when changing screen size. I have AutoResizeChildren turned on but that still doesn't make a difference.

回答 (1 件)

VBBV
VBBV 2023 年 2 月 13 日
Set the scalemethod to fit option for the Image component in app designer
  4 件のコメント
VBBV
VBBV 2023 年 2 月 14 日
編集済み: VBBV 2023 年 2 月 14 日
function startupFcn(app)
app.UIFigure.Position = [300, 300, 650, 495]; % on a laptop screen
oPos = app.UIFigure.Position; % old position of screen coordinates for App
nPos = get(app.UIFigure, 'Position'); % get the new position of screen coordinates for App
ratio = [nPos(1)/oPos(1) nPos(2)/oPos(2) nPos(3)/oPos(3), nPos(4)/oPos(4)]; % take the ratio
app.UIFigure.Position = [app.UIFigure.Position(1)*ratio(1) app.UIFigure.Position(2)*ratio(2) app.UIFigure.Position(3)*ratio(3) app.UIFigure.Position(4)*ratio(4)];
% Rescale the new position with ratio
end
You can use get function which is useful to set the properties of screen coordinates when the user resizes the App. Add the above code in startupFcn in app, and it seems to have solved problem with resizing the layout of app & its comnponents now.
VBBV
VBBV 2023 年 2 月 15 日
It's better to use GUIDE to develop GUI instead of App designer , and later migrate to App designer. Hope this solves your problem

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by