■ FontStyleConverter 클래스의 ConvertToString/ConvertFromString 메소드를 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
using System; using System.Windows; FontStyleConverter converter = new FontStyleConverter(); string normalString = converter.ConvertToString(FontStyles.Normal ); string obliqueString = converter.ConvertToString(FontStyles.Oblique); string italicString = converter.ConvertToString(FontStyles.Italic ); Console.WriteLine(normalString ); Console.WriteLine(obliqueString); Console.WriteLine(italicString ); Console.WriteLine(); FontStyle normalFontStyle = (FontStyle)converter.ConvertFromString(normalString ); FontStyle obliqueFontStyle = (FontStyle)converter.ConvertFromString(obliqueString); FontStyle italicFontStyle = (FontStyle)converter.ConvertFromString(italicString ); Console.WriteLine(normalFontStyle ); Console.WriteLine(obliqueFontStyle); Console.WriteLine(italicFontStyle ); |