C# FontStyle枚举的使用

来源:互联网 发布:win10 网络 编辑:程序博客网 时间:2024/05/14 10:05

C# FontStyle枚举的使用

 

FontStyle同时是bold,Underline,Strikeout风格:
FontStyle style = FontStyle.Regular;
style |= FontStyle.Bold;
style |= FontStyle.Italic;
如果是去掉某一种的话是:
style-=FontStyle.Bold;

//將String转换成FontStyle枚举
FontStyle fsStyle = (FontStyle)Enum.Parse(typeof(FontStyle), sContentFontStyle);
sContentFontStyle為FontStyle的string值,多個時以","分隔 。如:
FontStyle fsStyle = (FontStyle)Enum.Parse(typeof(FontStyle), "Bold,Italic,Underline,Strikeout");

原创粉丝点击