任何人都可以告诉我如何设置FontDialog的默认字体名称,字体大小,字体颜色..;更改c#中的默认字体对话框
FontDialog dlg = new FontDialog();
dlg.ShowColor = true;
if (dlg.ShowDialog() != DialogResult.OK) return;
The dlg.ShowDialog();方法应该显示我选择的字体名称insted“microsoft san serif”
任何人都可以告诉我如何设置FontDialog的默认字体名称,字体大小,字体颜色..;更改c#中的默认字体对话框
FontDialog dlg = new FontDialog();
dlg.ShowColor = true;
if (dlg.ShowDialog() != DialogResult.OK) return;
The dlg.ShowDialog();方法应该显示我选择的字体名称insted“microsoft san serif”
您只需在调用ShowDialog
之前设置Font
属性。
例如:
dlg.Font = new Font("Consolas", 10);
//or
dlg.Font = myCurrentlySelectedFont;
另外值得指出的是,从字体对话框中获得的字体名称的时候,你想要的值:fontDlg.Font.Name
,或者fontDlg.Font.FontFamily.Name
。
在显示对话框之前,此值将正确地允许您设置上述字体名称。
下划线和删除属性 – 2012-02-29 12:16:43
var myFont = new Font(“Consolas”,10); myFont.Underline = true; dlg.Font = myFont' – abhilash 2012-02-29 12:24:00