| MATLAB Function Reference | ![]() |
Syntax
uisetfont uisetfont(h) uisetfont(S) uisetfont(h,'DialogTitle') uisetfont(S,'DialogTitle') S = uisetfont(...)
Description
uisetfont 可針對 text, axes, or uicontrol
物件改變字型的屬性(FontName, FontUnits, FontSize, FontWeight, and FontAngle)。函式回傳一結構其由字型的屬性所組成。還可自行定義對話盒的標題。
uisetfont(h)
顯示對話盒,依頭銜(handle)為 h
的物件預設字型屬性。依現行的物件選擇字型屬性。若有第二個參數,則代表對話盒的名稱。
uisetfont(S)
顯示一對話盒,依結構 (S) 的值定義字型屬性。S
必須為合理的值,即以下其中之一:FontName, FontUnits, FontSize, FontWeight,
和 FontAngle,欄位的名稱必須對應屬性的名稱。若有其他的屬性被定義,則會被忽略。若有第二個參數,即表示對話盒的名稱。
uisetfont(' 顯示標題為 DialogTitle')
DialogTitle 的對話盒並回傳對話盒的字型屬性。
若有等號左邊的參數,則 FontName, FontUnits, FontSize, FontWeight,
和 FontAngle 等性質將會被視為結構的欄位回傳之。若使用者按下對話盒的 Cancel
鈕或有錯誤發生,輸出值將設為 0。
Example
以下敘述開啟一本文物件。然後顯示一對話盒讓使用者可更改字型:
h = text(.5,.5,'Figure Annotation'); uisetfont(h,'Update Font')
以下的敘述開啟兩個按鈕,並將其一的字型屬性值設定到另一控制上:
% Create push button with string ABC
c1 = uicontrol('Style', 'pushbutton', ...
'Position', [10 10 100 20], 'String', 'ABC');
% Create push button with string XYZ
c2 = uicontrol('Style', 'pushbutton', ...
'Position', [10 50 100 20], 'String', 'XYZ');
% Display set font dialog box for c1, make selections, save to d
d = uisetfont(c1)
% Apply those settings to c2
set(c2, d)
See Also
| uisetcolor | undocheckout | ![]() |