How to change the colour and font size of uifigure name?

6 ビュー (過去 30 日間)
Lee
Lee 2025 年 3 月 24 日
コメント済み: Lee 2025 年 3 月 24 日
How to change the colour and font size of uifigure name?
  2 件のコメント
DGM
DGM 2025 年 3 月 24 日
If you're talking about the titlebar size and text properties, then I assume those parts of the window decorations are dictated by the window manager theme (or other system theme), not MATLAB. I'm free to be corrected on that, but I don't see the propriety of it either way.
Lee
Lee 2025 年 3 月 24 日
For example, fig = uifigure("Name","my gui", ...); I dont' see any property setting for the name's color and its font size. Thanks

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

採用された回答

TED MOSBY
TED MOSBY 2025 年 3 月 24 日
Hi Lee,
@DGM is correct. The title bar’s appearance—font size, color, alignment, etc. is controlled by the operating system’s window manager, not by MATLAB.
If you need to display a custom-styled title (including color, font face, size, etc.), a workaround can be to place a label or text at the top of your app, just under the actual title bar. For example:
function createCustomTitledApp()
fig = uifigure('Name','Default OS Title Bar'); % This cannot be styled.
% Create a label at the top with custom style
lbl = uilabel(fig);
lbl.Text = 'My Styled Title';
lbl.FontSize = 20;
lbl.FontWeight = 'bold';
lbl.FontColor = [1 0 0];
% Position the label at the top
lbl.Position = [20 fig.Position(4)-60 300 40];
% Adjust as needed for your layout
end
For more information on 'uifgure' refer to this documentation:
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by