msgboxFontSize

버전 2.3 (3.32 KB) 작성자: Adam Danz
Change the fontsize and other text properties in a msgbox(), errordlg(), warndlg() etc.
다운로드 수: 406
업데이트 날짜: 2019/7/24

라이선스 보기

편집자 메모: This file was selected as MATLAB Central Pick of the Week

h = msgbox('Hello world (20 pt font)', 'Example');
msgboxFontSize(h, fontsize)
msgboxFontSize(h, fontsize, 'FontName', 'Consolas', 'Color', 'b')
msgboxFontSize(h, fontsize, 'ignorebuttons', true) % does not apply change to buttons.

The text properties in Matlab's msgbox(), errordlg(), warndlg(), etc cannot be directly
edited and the default 'fontsize' is quite small. This function gets around that problem
by searching for text within the msgbox handle, changes its fontsize, and then changes
the window size to fit the new fontsize. The position of the lower, left corner of
the msgbox will not change and the resize property is turned on. Additional name-value
text properties can be set except for 'units' (see examples).

Outputs include the handle to the text object and handles to all pushbuttons. The help section
shows how to get the handle to the icon in errordlg & warndlg as well.

List of text properties: https://www.mathworks.com/help/matlab/ref/matlab.graphics.primitive.text-properties.html

** Also see supersizeme() which contains an interactive GUI with a slider that allows you to scale the font size of all text within a figure or axes.
https://www.mathworks.com/matlabcentral/fileexchange/67644-supersizeme

인용 양식

Adam Danz (2024). msgboxFontSize (https://www.mathworks.com/matlabcentral/fileexchange/68460-msgboxfontsize), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014a
R2014a 이상 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Graphics Object Programming에 대해 자세히 알아보기
도움

줌: Spur-Gear-Designer

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
2.3

Now compatible with older releases (tested in r2014a, r2016a, r2017b, r2019a).
Replaces isvalid() with ishghandle() and dot notation with get/set.

2.2

Properties now applied to buttons though the buttons are not resized.

2.1.1

Just updated the description. No change to m file.

2.1

1) suppresses output from set() when inputs do not include property-value pairs.
2) includes button handle outputs.

2.0

Added the ability to specify all name-value text properties.

1.0.1

Simplified one line by replacing set() with dot notation.

1.0.0