markus / KCOM / Common / InitData.cs @ 19391ad3
이력 | 보기 | 이력해설 | 다운로드 (2.35 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 | |||
7 | 787a4489 | KangIngu | namespace KCOM.Views |
8 | { |
||
9 | public class DashStyle |
||
10 | { |
||
11 | public DoubleCollection dashData { get; set; } |
||
12 | } |
||
13 | |||
14 | public partial class TopMenu : UserControl |
||
15 | { |
||
16 | public List<DashStyle> dashSet; |
||
17 | |||
18 | public void InitDataSet() |
||
19 | { |
||
20 | dashSet = new List<DashStyle>() |
||
21 | { |
||
22 | new DashStyle { dashData = new DoubleCollection{999999}}, |
||
23 | new DashStyle { dashData = new DoubleCollection{2,2}}, |
||
24 | new DashStyle { dashData = new DoubleCollection{4,4}}, |
||
25 | new DashStyle { dashData = new DoubleCollection{8,8}}, |
||
26 | new DashStyle { dashData = new DoubleCollection{20,0,0, 5,1.1,5}}, |
||
27 | new DashStyle { dashData = new DoubleCollection{10,10}}, |
||
28 | new DashStyle { dashData = new DoubleCollection{15,15}}, |
||
29 | new DashStyle { dashData = new DoubleCollection{15,3,3,0,3,3}}, |
||
30 | new DashStyle { dashData = new DoubleCollection{15,3,3,3,3,3}}, |
||
31 | }; |
||
32 | cbDashStyle.ItemsSource = dashSet.ToList(); |
||
33 | 1ba2b03d | ljiyeon | |
34 | 78d91584 | ljiyeon | List<string> fontList = new List<string>(); |
35 | fontList.Add("Arial"); |
||
36 | fontList.Add("Calibri (Body)"); |
||
37 | fontList.Add("Tahoma"); |
||
38 | fontList.Add("Verdana"); |
||
39 | fontList.Add("Times New Roman"); |
||
40 | fontList.Add("Cambria"); |
||
41 | //fontList.Add("나눔바른펜"); |
||
42 | List<string> fontSet = new List<string>(); |
||
43 | foreach (var font in fontList) |
||
44 | 1ba2b03d | ljiyeon | { |
45 | 78d91584 | ljiyeon | if (IsFontInstalled(font)) |
46 | { |
||
47 | fontSet.Add(font.ToString()); |
||
48 | } |
||
49 | } |
||
50 | 1ba2b03d | ljiyeon | comboFontFamily.ItemsSource = fontSet.ToList(); |
51 | 78d91584 | ljiyeon | } |
52 | 1ba2b03d | ljiyeon | |
53 | /// <summary> |
||
54 | /// 폰트 설치 여부 구하기 |
||
55 | /// </summary> |
||
56 | public bool IsFontInstalled(string fontName) |
||
57 | { |
||
58 | InstalledFontCollection collection = new InstalledFontCollection(); |
||
59 | 78d91584 | ljiyeon | foreach (System.Drawing.FontFamily fontFamily in collection.Families) |
60 | 1ba2b03d | ljiyeon | { |
61 | 78d91584 | ljiyeon | if (fontFamily.Name.Equals(fontName)) |
62 | 1ba2b03d | ljiyeon | { |
63 | return true; |
||
64 | } |
||
65 | } |
||
66 | return false; |
||
67 | 78d91584 | ljiyeon | } |
68 | 1ba2b03d | ljiyeon | } |
69 | 787a4489 | KangIngu | } |