markus / MarkupToPDF / Controls / Common / BaseShape.cs @ 684ef11c
이력 | 보기 | 이력해설 | 다운로드 (6.77 KB)
1 |
//using System; |
---|---|
2 |
//using System.Collections.Generic; |
3 |
//using System.ComponentModel; |
4 |
//using System.Linq; |
5 |
//using System.Text; |
6 |
//using System.Threading.Tasks; |
7 |
//using System.Windows; |
8 |
//using System.Windows.Controls; |
9 |
//using System.Windows.Shapes; |
10 |
//using System.Windows.Media; |
11 |
|
12 |
//namespace MarkupToPDF.Controls.Common |
13 |
//{ |
14 |
// public class BaseShape : Control, IDisposable, INotifyPropertyChanged, IMarkupCommonData |
15 |
// { |
16 |
// public Path Base_BasePath { get; set; } |
17 |
|
18 |
|
19 |
// #region Property |
20 |
|
21 |
// public Point StartPoint |
22 |
// { |
23 |
// get |
24 |
// { |
25 |
// return (Point)GetValue(StartPointProperty); |
26 |
// } |
27 |
// set |
28 |
// { |
29 |
// SetValue(StartPointProperty, value); |
30 |
// OnPropertyChanged("StartPoint"); |
31 |
// } |
32 |
// } |
33 |
|
34 |
// public Point EndPoint |
35 |
// { |
36 |
// get |
37 |
// { |
38 |
// return (Point)GetValue(EndPointProperty); |
39 |
// } |
40 |
// set |
41 |
// { |
42 |
// SetValue(EndPointProperty, value); |
43 |
// OnPropertyChanged("EndPoint"); |
44 |
// } |
45 |
// } |
46 |
|
47 |
// public bool IsSelected |
48 |
// { |
49 |
// get |
50 |
// { |
51 |
// return (bool)GetValue(IsSelectedProperty); |
52 |
// } |
53 |
// set |
54 |
// { |
55 |
// SetValue(IsSelectedProperty, value); |
56 |
// OnPropertyChanged("IsSelected"); |
57 |
// } |
58 |
// } |
59 |
|
60 |
// public double CanvasX |
61 |
// { |
62 |
// get { return (double)GetValue(CanvasXProperty); } |
63 |
// set |
64 |
// { |
65 |
// if (this.CanvasX != value) |
66 |
// { |
67 |
// SetValue(CanvasXProperty, value); |
68 |
// OnPropertyChanged("CanvasX"); |
69 |
// } |
70 |
// } |
71 |
// } |
72 |
|
73 |
// public double CanvasY |
74 |
// { |
75 |
// get { return (double)GetValue(CanvasYProperty); } |
76 |
// set |
77 |
// { |
78 |
// if (this.CanvasY != value) |
79 |
// { |
80 |
// SetValue(CanvasYProperty, value); |
81 |
// OnPropertyChanged("CanvasY"); |
82 |
// } |
83 |
// } |
84 |
// } |
85 |
|
86 |
// public ControlType ControlType |
87 |
// { |
88 |
// set |
89 |
// { |
90 |
// SetValue(ControlTypeProperty, value); |
91 |
// OnPropertyChanged("ControlType"); |
92 |
// } |
93 |
// get |
94 |
// { |
95 |
// return (ControlType)GetValue(ControlTypeProperty); |
96 |
// } |
97 |
// } |
98 |
|
99 |
// #endregion Property |
100 |
|
101 |
// #region Dependency Property |
102 |
|
103 |
// public static readonly DependencyProperty IsSelectedProperty = |
104 |
// DependencyProperty.Register("IsSelected", typeof(bool), typeof(BaseShape), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
105 |
|
106 |
// public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register( |
107 |
// "CanvasX", typeof(double), typeof(BaseShape), new PropertyMetadata((double)0, OnSetCansvasChanged)); |
108 |
|
109 |
// public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register( |
110 |
// "CanvasY", typeof(double), typeof(BaseShape), new PropertyMetadata((double)0, OnSetCansvasChanged)); |
111 |
|
112 |
// public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
113 |
// "StartPoint", typeof(Point), typeof(BaseShape), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
114 |
|
115 |
// public static readonly DependencyProperty SetPointProperty = DependencyProperty.Register( |
116 |
// "SetPoint", typeof(Point), typeof(BaseShape), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
117 |
|
118 |
// public static readonly DependencyProperty OriginPointProperty = DependencyProperty.Register( |
119 |
// "OriginPoint", typeof(Point), typeof(BaseShape), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
120 |
|
121 |
// public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
122 |
// "EndPoint", typeof(Point), typeof(BaseShape), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
123 |
|
124 |
// public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
125 |
// "PointSet", typeof(List<Point>), typeof(BaseShape), new PropertyMetadata(new List<Point>(), PointValueChanged)); |
126 |
|
127 |
// public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
128 |
// "StrokeColor", typeof(SolidColorBrush), typeof(BaseShape), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
129 |
|
130 |
// public static readonly DependencyProperty ControlTypeProperty = |
131 |
// DependencyProperty.Register("ControlType", typeof(ControlType), typeof(BaseShape), new FrameworkPropertyMetadata(ControlType.Rectangle)); |
132 |
|
133 |
// #endregion Dependency Property |
134 |
|
135 |
// #region Dependency PropertyChanged |
136 |
|
137 |
// public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
138 |
// { |
139 |
// var instance = (BaseShape)sender; |
140 |
|
141 |
// if (e.OldValue != e.NewValue && instance != null) |
142 |
// { |
143 |
// instance.SetValue(e.Property, e.NewValue); |
144 |
// } |
145 |
// } |
146 |
|
147 |
// public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
148 |
// { |
149 |
// var instance = (BaseShape)sender; |
150 |
|
151 |
// if (e.OldValue != e.NewValue && instance.Base_BasePath != null) |
152 |
// { |
153 |
// instance.SetValue(e.Property, e.NewValue); |
154 |
|
155 |
// if (instance.IsSelected) |
156 |
// { |
157 |
// instance.Base_BasePath.Stroke = new SolidColorBrush(Colors.Blue); |
158 |
// } |
159 |
// else |
160 |
// { |
161 |
// instance.Base_BasePath.Stroke = new SolidColorBrush(Colors.Red); |
162 |
// } |
163 |
// } |
164 |
// } |
165 |
|
166 |
// public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
167 |
// { |
168 |
// var instance = (BaseShape)sender; |
169 |
|
170 |
// if (e.OldValue != e.NewValue && instance.Base_BasePath != null) |
171 |
// { |
172 |
// instance.SetValue(e.Property, e.NewValue); |
173 |
// //instance.SetRectPath(instance); |
174 |
// } |
175 |
// } |
176 |
|
177 |
// #endregion Dependency PropertyChanged |
178 |
|
179 |
|
180 |
// #region Internal Method |
181 |
// private void OnPropertyChanged(string name) |
182 |
// { |
183 |
// if (PropertyChanged != null) |
184 |
// { |
185 |
// PropertyChanged(this, new PropertyChangedEventArgs(name)); |
186 |
// } |
187 |
// } |
188 |
|
189 |
// public event PropertyChangedEventHandler PropertyChanged; |
190 |
|
191 |
// public void Dispose() |
192 |
// { |
193 |
// GC.Collect(); |
194 |
// GC.SuppressFinalize(this); |
195 |
// } |
196 |
|
197 |
// #endregion Internal Method |
198 |
// } |
199 |
//} |