How can I change the font size of MsgBox?

162 ビュー (過去 30 日間)
Muhendisleksi
Muhendisleksi 2018 年 4 月 16 日
コメント済み: Claudio Camarra 2020 年 4 月 8 日
if f==0 || f <0
Message = sprintf('Serbestlik derecesi %d\n DENGELEME YOK!!! ',f);
h = msgbox(Message,...
'Dikkat', 'warn');
end

回答 (2 件)

Adam Danz
Adam Danz 2018 年 6 月 26 日
編集済み: Adam Danz 2018 年 8 月 20 日
Here's a function I wrote that does exactly this. Pass the handle of the msgbox() and the fontsize to the function.
If you don't want a function, here's the basics:
First get the handle to the text within the message box, then change the font size. Here's a demo.
mh = msgbox('I can barely read this.', 'test'); %create msgbox
th = findall(mh, 'Type', 'Text'); %get handle to text within msgbox
th.FontSize = 14; %Change the font size
If you increase the font size too much, you'll need to expand the message box to fit the extent of the text.
deltaWidth = sum(th.Extent([1,3]))-mh.Position(3) + th.Extent(1);
deltaHeight = sum(th.Extent([2,4]))-mh.Position(4) + 10;
mh.Position([3,4]) = mh.Position([3,4]) + [deltaWidth, deltaHeight];
Lastly, allow the user to resize the window if needed:
mh.Resize = 'on';

Anibal Siguenza Torres
Anibal Siguenza Torres 2018 年 8 月 20 日
編集済み: Anibal Siguenza Torres 2018 年 8 月 20 日
The easiest is to use the TeX format so the subset of markup supported by matlab can be used. To activate them you have to create an structure and send it as parameter as follows:
CreateStruct.Interpreter = 'tex';
CreateStruct.WindowStyle = 'modal';
msgbox('\fontsize{18} Now is big =)', CreateStruct)
  1 件のコメント
Claudio Camarra
Claudio Camarra 2020 年 4 月 8 日
lo que escribiste....no funciona-.

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

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by