您的位置:首页 > 编程语言 > C#

C# FontStyle枚举的使用 (將String转换成FontStyle枚举)

2013-12-13 14:03 281 查看
//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");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: