markus / KCOM / Common / InitData.cs @ 299f2c11
이력 | 보기 | 이력해설 | 다운로드 (3.52 KB)
1 | 78d91584 | ljiyeon | using System.Collections.Generic; |
---|---|---|---|
2 | 787a4489 | KangIngu | using System.Linq; |
3 | using System.Windows.Controls; |
||
4 | using System.Windows.Media; |
||
5 | 1ba2b03d | ljiyeon | using System.Drawing.Text; |
6 | e0cfc73c | ljiyeon | using KCOM.Common; |
7 | 24c5e56c | taeseongkim | using Markus.Fonts; |
8 | 1ba2b03d | ljiyeon | |
9 | 787a4489 | KangIngu | namespace KCOM.Views |
10 | { |
||
11 | public class DashStyle |
||
12 | { |
||
13 | public DoubleCollection dashData { get; set; } |
||
14 | } |
||
15 | |||
16 | public partial class TopMenu : UserControl |
||
17 | { |
||
18 | public List<DashStyle> dashSet; |
||
19 | |||
20 | public void InitDataSet() |
||
21 | { |
||
22 | e0cfc73c | ljiyeon | App.splashString(ISplashMessage.INITDATA); |
23 | 787a4489 | KangIngu | dashSet = new List<DashStyle>() |
24 | { |
||
25 | new DashStyle { dashData = new DoubleCollection{999999}}, |
||
26 | new DashStyle { dashData = new DoubleCollection{2,2}}, |
||
27 | new DashStyle { dashData = new DoubleCollection{4,4}}, |
||
28 | new DashStyle { dashData = new DoubleCollection{8,8}}, |
||
29 | new DashStyle { dashData = new DoubleCollection{20,0,0, 5,1.1,5}}, |
||
30 | new DashStyle { dashData = new DoubleCollection{10,10}}, |
||
31 | new DashStyle { dashData = new DoubleCollection{15,15}}, |
||
32 | new DashStyle { dashData = new DoubleCollection{15,3,3,0,3,3}}, |
||
33 | new DashStyle { dashData = new DoubleCollection{15,3,3,3,3,3}}, |
||
34 | }; |
||
35 | cbDashStyle.ItemsSource = dashSet.ToList(); |
||
36 | 1ba2b03d | ljiyeon | |
37 | 24c5e56c | taeseongkim | //List<string> fontList = new List<string>(); |
38 | //fontList.Add("Arial"); |
||
39 | ////fontList.Add("Calibri (Body)"); |
||
40 | ////fontList.Add("Tahoma"); |
||
41 | //fontList.Add("Verdana"); |
||
42 | //fontList.Add("Times New Roman"); |
||
43 | //fontList.Add("Cambria"); |
||
44 | ////fontList.Add("나눔바른펜"); |
||
45 | //List<string> fontSet = new List<string>(); |
||
46 | //foreach (var font in fontList) |
||
47 | //{ |
||
48 | // if (IsFontInstalled(font)) |
||
49 | // { |
||
50 | // fontSet.Add(font.ToString()); |
||
51 | // } |
||
52 | //} |
||
53 | var fontsItems = Markus.Fonts.FontDictionary.GetMarkusFonts(); |
||
54 | comboFontFamily.ItemsSource = fontsItems; |
||
55 | c5519c44 | taeseongkim | |
56 | 24c5e56c | taeseongkim | comboFontFamily.SelectedItem = fontsItems.FirstOrDefault(x => x.IsDefault); |
57 | c206d293 | taeseongkim | } |
58 | |||
59 | public void SetFont(FontFamily fontFamily) |
||
60 | { |
||
61 | foreach (var item in comboFontFamily.Items) |
||
62 | { |
||
63 | 24c5e56c | taeseongkim | if((item as Markus.Fonts.MarkusFont).FontFamily.FontName() == fontFamily.FontName()) |
64 | c206d293 | taeseongkim | { |
65 | 4fcb686a | taeseongkim | IsSuspendChange = true; |
66 | c206d293 | taeseongkim | comboFontFamily.SelectedItem = item; |
67 | 4fcb686a | taeseongkim | IsSuspendChange = false; |
68 | c206d293 | taeseongkim | return; |
69 | } |
||
70 | } |
||
71 | } |
||
72 | 4fcb686a | taeseongkim | |
73 | public Markus.Fonts.MarkusFont GetFontFamily() |
||
74 | { |
||
75 | if (comboFontFamily.SelectedItem != null) |
||
76 | { |
||
77 | return comboFontFamily.SelectedItem as Markus.Fonts.MarkusFont; |
||
78 | } |
||
79 | else |
||
80 | { |
||
81 | return new Markus.Fonts.MarkusFont(); |
||
82 | } |
||
83 | } |
||
84 | |||
85 | /// <summary> |
||
86 | /// font change event suspend |
||
87 | /// </summary> |
||
88 | public bool IsSuspendChange; |
||
89 | 1ba2b03d | ljiyeon | |
90 | /// <summary> |
||
91 | /// 폰트 설치 여부 구하기 |
||
92 | /// </summary> |
||
93 | public bool IsFontInstalled(string fontName) |
||
94 | { |
||
95 | InstalledFontCollection collection = new InstalledFontCollection(); |
||
96 | 78d91584 | ljiyeon | foreach (System.Drawing.FontFamily fontFamily in collection.Families) |
97 | 1ba2b03d | ljiyeon | { |
98 | 78d91584 | ljiyeon | if (fontFamily.Name.Equals(fontName)) |
99 | 1ba2b03d | ljiyeon | { |
100 | return true; |
||
101 | } |
||
102 | } |
||
103 | return false; |
||
104 | 78d91584 | ljiyeon | } |
105 | 1ba2b03d | ljiyeon | } |
106 | 787a4489 | KangIngu | } |