更改内置对话框的字体大小
吉罗‘s Pick this week ismsgboxFontSizebyAdam Danz.
This utility reminded me of a very recent project, which would have benefited greatly. I was building an app that made use of警告和errordlg. I needed to show the app as part of a presentation, and that required me to make the fonts bigger. The app itself, I had control over. But there were no parameters I could tweak in警告和errordlgto make their fonts bigger. I ended up modifying the built-in functions themselves to allow me to specify the font size.
Adam’s utility would have saved me a lot of trouble. His function takes an existing dialog box created bymsgbox,警告,errordlg和changes the font size and other properties by searching for the text objects.
For example, take this standard warning dialog.
h = warndlg('This is the normal error dialog','Error');
Let’s change the font size to 30, and while we’re at it, we’ll also change the text.
msgboxFontSize(h,30,'String','Notice how the font is bigger now!');
Notice that the dialog width is adjusted based on the font size.
I have a couple of enhancement requests for Adam.
- 如果我们还可以更改按钮的字体大小(上面示例中的“确定”按钮),那就太好了。
- It would be even greater if the icon size (the exclamation mark icon in the above example) increased proportionally as well.
注释
- Category:
- Picks
注释
To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.