本文介绍了C#检索fontdialog的样式,名称和大小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我的问题在标题中...
我可以得到名字,大小,但不是风格。你想念我的是什么?
谢谢





我尝试过:



< pre lang =c#> 
FontDialog类DLG =新FontDialog类
{
ShowColor =假,
ShowApply =假,
ShowEffects =假,
ShowHelp =假,
// AllowVerticalFonts = false,
// AllowScriptChange = false,
// FixedPitchOnly = true,
MinSize = 9,
MaxSize = 16
};


如果(Dlg.ShowDialog()== DialogResult.OK)
{
串的fontName = Dlg.Font.Name;
fontStyle = Dlg.Font.Style; //这段代码不起作用....
float fontSize = Dlg.Font.Size;

TxtPolice.Text = fontName;
TxtStyle.Text = fontStyle; //这段代码不起作用....
TxtFont.Text =+ fontSize;
}
解决方案



Hello,
My question is in the title ...
I can get the name, the size, but not the Style..What do you miss me?
Thank you



What I have tried:

<pre lang="c#">
                   FontDialog Dlg = new FontDialog
                {
                    ShowColor = false,
                    ShowApply = false,
                    ShowEffects = false,
                    ShowHelp = false,
                   //   AllowVerticalFonts = false,
                    //  AllowScriptChange = false,
                   //   FixedPitchOnly = true,
                    MinSize = 9,
                    MaxSize = 16
                };


 if (Dlg.ShowDialog() == DialogResult.OK)
                {
                    string fontName = Dlg.Font.Name;
                     fontStyle = Dlg.Font.Style; // This code does not work ....
                    float fontSize = Dlg.Font.Size;

                    TxtPolice.Text = fontName;
                    TxtStyle.Text = fontStyle; // This code does not work ....
                    TxtFont.Text = "" + fontSize;
                }
解决方案




这篇关于C#检索fontdialog的样式,名称和大小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 08:17