markus / KCOM / Common / InitData.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (3.52 KB)
1 |
using System.Collections.Generic; |
---|---|
2 |
using System.Linq; |
3 |
using System.Windows.Controls; |
4 |
using System.Windows.Media; |
5 |
using System.Drawing.Text; |
6 |
using KCOM.Common; |
7 |
using Markus.Fonts; |
8 |
|
9 |
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 |
App.splashString(ISplashMessage.INITDATA); |
23 |
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 |
|
37 |
//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 |
|
56 |
comboFontFamily.SelectedItem = fontsItems.FirstOrDefault(x => x.IsDefault); |
57 |
} |
58 |
|
59 |
public void SetFont(FontFamily fontFamily) |
60 |
{ |
61 |
foreach (var item in comboFontFamily.Items) |
62 |
{ |
63 |
if((item as Markus.Fonts.MarkusFont).FontFamily.FontName() == fontFamily.FontName()) |
64 |
{ |
65 |
IsSuspendChange = true; |
66 |
comboFontFamily.SelectedItem = item; |
67 |
IsSuspendChange = false; |
68 |
return; |
69 |
} |
70 |
} |
71 |
} |
72 |
|
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 |
|
90 |
/// <summary> |
91 |
/// 폰트 설치 여부 구하기 |
92 |
/// </summary> |
93 |
public bool IsFontInstalled(string fontName) |
94 |
{ |
95 |
InstalledFontCollection collection = new InstalledFontCollection(); |
96 |
foreach (System.Drawing.FontFamily fontFamily in collection.Families) |
97 |
{ |
98 |
if (fontFamily.Name.Equals(fontName)) |
99 |
{ |
100 |
return true; |
101 |
} |
102 |
} |
103 |
return false; |
104 |
} |
105 |
} |
106 |
} |