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");
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");
相关文章推荐
- C# FontStyle枚举的使用
- C# FontStyle枚举的使用
- c# 枚举Enum和int转换(不使用强转)
- C#枚举 枚举和int以及string类型之间的转换 结构 重载 全局变量
- C# 枚举类型转换字符串 Enum to string,枚举转换为下拉菜单 Enum DropDownList
- C# Enum,Int,String的互相转换 枚举转换
- (转)C# Enum,Int,String的互相转换 枚举转换
- C++封装C#的类库DLL,并c++中C#的string类型的转换使用
- C#中String对象转换为Font对象的方法
- C# String轉成FontStyle
- (转)C# Enum,Int,String的互相转换 枚举转换--非常实用
- C# Enum,Int,String的互相转换 枚举转换
- 在C#中如何使用BYTE[]转换为String
- C# Enum,Int,String的互相转换 枚举转换
- (转)C# Enum,Int,String的互相转换 枚举转换
- C#中使用DateTime.ToString()转换输出日期
- C# Enum,Int,String的互相转换 枚举转换
- (转)C# Enum,Int,String的互相转换 枚举转换
- (转)C# Enum,Int,String的互相转换 枚举转换 、循环读取
- C# 枚举类型转换字符串 Enum to string,枚举转换为下拉菜单 Enum DropDownList