来自FontDialog的重量 [英] Weight from FontDialog
本文介绍了来自FontDialog的重量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
如何从System.Drawing.FontDialog获得重量?
我可以在对话框窗口中选择它,但它不可能读取值?
解决方案
如果它与WPF有关,请检查这个
fontdialog [ ^ ]
< span class =code-keyword> private void button1_Click_1( object sender,EventArgs e )
{
FontDialog fontDialog1 = new FontDialog();
// 显示对话框。
DialogResult result = fontDialog1.ShowDialog() ;
// 查看是否按下确定。
if (result == DialogResult.OK)
{
// 获取字体。
Font font = fontDialog1.Font;
// 设置TextBox属性。
this .textBox1.Text = string .Format( Font是:{0},style是:{1},font.Name,font.Style);
此 .textBox1.Font = font;
}
}
这里font.Style显示你从FontDialog中选择的样式
Hi there,
how to get the weight from System.Drawing.FontDialog?
I can choose it in dialog window, but its not possible to read the value?
解决方案
if it is related to WPF,check this
fontdialog[^]
private void button1_Click_1(object sender, EventArgs e) { FontDialog fontDialog1 = new FontDialog(); // Show the dialog. DialogResult result = fontDialog1.ShowDialog(); // See if OK was pressed. if (result == DialogResult.OK) { // Get Font. Font font = fontDialog1.Font; // Set TextBox properties. this.textBox1.Text = string.Format("Font is: {0} and style is: {1}", font.Name,font.Style); this.textBox1.Font = font; } }
Here font.Style shows the style you selected from FontDialog
这篇关于来自FontDialog的重量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文