這是用C#更改字體大小的最簡單方法。最簡單的方法來更改字體和字體大小
與java它可以通過調用具有必要參數的Font構造函數來輕鬆完成。
JLabel lab = new JLabel("Font Bold at 24");
lab.setFont(new Font("Serif", Font.BOLD, 24));
這是用C#更改字體大小的最簡單方法。最簡單的方法來更改字體和字體大小
與java它可以通過調用具有必要參數的Font構造函數來輕鬆完成。
JLabel lab = new JLabel("Font Bold at 24");
lab.setFont(new Font("Serif", Font.BOLD, 24));
也許是這樣的:
yourformName.YourLabel.Font = new Font("Arial", 24,FontStyle.Bold);
或者如果你是在同一個班的形式,然後簡單地做到這一點:
YourLabel.Font = new Font("Arial", 24,FontStyle.Bold);
的構造函數不同勢參數(所以挑你的毒藥)。就像這樣:
Font(Font, FontStyle)
Font(FontFamily, Single)
Font(String, Single)
Font(FontFamily, Single, FontStyle)
Font(FontFamily, Single, GraphicsUnit)
Font(String, Single, FontStyle)
Font(String, Single, GraphicsUnit)
Font(FontFamily, Single, FontStyle, GraphicsUnit)
Font(String, Single, FontStyle, GraphicsUnit)
Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte)
Font(String, Single, FontStyle, GraphicsUnit, Byte)
Font(FontFamily, Single, FontStyle, GraphicsUnit, Byte, Boolean)
Font(String, Single, FontStyle, GraphicsUnit, Byte, Boolean)
參考here
這應該這樣做(黑體爲好);
label1.Font = new Font("Serif", 24,FontStyle.Bold);
使用Font Class來設置控件的字體和樣式。
嘗試Font Constructor (String, Single)
Label lab = new Label();
lab.Text ="Font Bold at 24";
lab.Font = new Font("Arial", 20);
或
lab.Font = new Font(FontFamily.GenericSansSerif,
12.0F, FontStyle.Bold);
要獲得安裝的字體是指本 - .NET System.Drawing.Font - Get Available Sizes and Styles
使用這一個只改變字體大小不是字體的名稱
label1.Font = new System.Drawing.Font(label1.Font.Name, 24F);
您也可以創建一個變量,然後將其分配給一個文本。這很酷,因爲你可以分配兩個或更多的文本。
要指定一個變量做
public partial class Sayfa1 : Form
Font Normal = new Font("Segoe UI", 9, FontStyle.Bold);
public Sayfa1()
這varible沒有分配到任何文本yet.To做到這一點寫入文本的名稱(看proporties - >(名稱)),然後寫「 .Font「,然後調用你的字體變量的名字。
lupusToolStripMenuItem.Font = Normal;
現在,您已將文本分配給普通字體。我希望我能幫上忙。