1 |
787a4489
|
KangIngu
|
using MarkupToPDF.Common;
|
2 |
|
|
using MarkupToPDF.Controls.Common;
|
3 |
|
|
using System;
|
4 |
|
|
using System.Collections.Generic;
|
5 |
|
|
using System.ComponentModel;
|
6 |
|
|
using System.Linq;
|
7 |
|
|
using System.Text;
|
8 |
|
|
using System.Threading.Tasks;
|
9 |
|
|
using System.Windows;
|
10 |
|
|
using System.Windows.Controls;
|
11 |
|
|
using System.Windows.Media;
|
12 |
|
|
using System.Windows.Shapes;
|
13 |
|
|
|
14 |
|
|
namespace MarkupToPDF.Controls.Text
|
15 |
|
|
{
|
16 |
|
|
[TemplatePart(Name = "PART_TextBox", Type = typeof(TextBox))]
|
17 |
|
|
[TemplatePart(Name = "PART_TextBlock", Type = typeof(TextBlock))]
|
18 |
|
|
[TemplatePart(Name = "PART_TextPath", Type = typeof(Path))]
|
19 |
|
|
[TemplatePart(Name = "PART_Border", Type = typeof(Border))]
|
20 |
|
|
[TemplatePart(Name = "PART_Grid", Type = typeof(Grid))]
|
21 |
|
|
public class TextControl : CommentUserInfo, INotifyPropertyChanged, IMarkupControlData, IPath
|
22 |
|
|
{
|
23 |
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
24 |
|
|
|
25 |
|
|
private const string PART_Grid = "PART_Grid";
|
26 |
|
|
private const string PART_Border = "PART_Border";
|
27 |
|
|
private const string PART_TextBox = "PART_TextBox";
|
28 |
|
|
private const string PART_TextPath = "PART_TextPath";
|
29 |
|
|
private const string PART_TextBlock = "PART_TextBlock";
|
30 |
|
|
//private const string PART_TextPrefix = "PART_TextPrefix";
|
31 |
|
|
|
32 |
|
|
public Path Base_TextPath = null;
|
33 |
|
|
public Grid Base_Grid = null;
|
34 |
|
|
public Border Base_Border = null;
|
35 |
|
|
//public TextBlock Base_TextPrefixBlock = null;
|
36 |
|
|
public TextBlock Base_TextBlock = null;
|
37 |
|
|
public TextBox Base_TextBox = null;
|
38 |
|
|
|
39 |
|
|
public RotateTransform _rotation = null;
|
40 |
|
|
public TranslateTransform _translation = null;
|
41 |
|
|
public ScaleTransform _scale = null;
|
42 |
|
|
|
43 |
53393bae
|
KangIngu
|
private const double _CloudArcDepth = 0.8; /// 2018.05.14 added by humkyung
|
44 |
5a9353a9
|
humkyung
|
|
45 |
787a4489
|
KangIngu
|
public bool IsSelected
|
46 |
|
|
{
|
47 |
|
|
get
|
48 |
|
|
{
|
49 |
|
|
return (bool)GetValue(IsSelectedProperty);
|
50 |
|
|
}
|
51 |
|
|
set
|
52 |
|
|
{
|
53 |
|
|
SetValue(IsSelectedProperty, value);
|
54 |
|
|
OnPropertyChanged("IsSelected");
|
55 |
|
|
}
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
#region Internal Method
|
59 |
|
|
|
60 |
|
|
public TextControl()
|
61 |
|
|
{
|
62 |
|
|
this.DefaultStyleKey = typeof(TextControl);
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
static TextControl()
|
66 |
|
|
{
|
67 |
|
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(TextControl), new FrameworkPropertyMetadata(typeof(TextControl)));
|
68 |
|
|
ResourceDictionary dictionary = new ResourceDictionary();
|
69 |
|
|
dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute);
|
70 |
|
|
Application.Current.Resources.MergedDictionaries.Add(dictionary);
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
public override void OnApplyTemplate()
|
74 |
|
|
{
|
75 |
|
|
base.OnApplyTemplate();
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
Base_TextPath = GetTemplateChild(PART_TextPath) as Path;
|
79 |
|
|
Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox;
|
80 |
|
|
Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock;
|
81 |
|
|
Base_Grid = GetTemplateChild(PART_Grid) as Grid;
|
82 |
|
|
Base_Border = GetTemplateChild(PART_Border) as Border;
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
//Base_TextPrefixBlock = GetTemplateChild(PART_TextPrefix) as TextBlock;
|
86 |
|
|
|
87 |
|
|
//Canvas.SetLeft(this, this.StartPoint.X);
|
88 |
|
|
//Canvas.SetTop(this, this.StartPoint.Y);
|
89 |
|
|
|
90 |
|
|
//CanvasX = StartPoint.X;
|
91 |
|
|
//CanvasY = StartPoint.Y;
|
92 |
|
|
|
93 |
|
|
//this.LostFocus += new RoutedEventHandler(TextControl_LostFocus);
|
94 |
|
|
//this.GotFocus += new RoutedEventHandler(TextControl_GotFocus);
|
95 |
|
|
this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
|
96 |
|
|
this.Base_TextBlock.SizeChanged += Base_TextBlock_SizeChanged;
|
97 |
|
|
|
98 |
|
|
this.Base_TextBox.LostFocus += Base_TextBox_LostFocus;
|
99 |
|
|
//this.MouseDown += TextControl_MouseDown;
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
SetText();
|
104 |
|
|
Base_TextBox.Focus();
|
105 |
|
|
|
106 |
|
|
this.Focusable = false;
|
107 |
|
|
if (!String.IsNullOrEmpty(this.Text))
|
108 |
|
|
{
|
109 |
|
|
Base_TextBlock.Visibility = Visibility.Visible;
|
110 |
|
|
Base_TextBox.Visibility = Visibility.Collapsed;
|
111 |
|
|
}
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
private void Base_TextBox_LostFocus(object sender, EventArgs e)
|
115 |
|
|
{
|
116 |
|
|
IsEditing = false;
|
117 |
|
|
UnEditingMode();
|
118 |
|
|
ApplyOverViewData();
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
public void ApplyOverViewData()
|
122 |
|
|
{
|
123 |
|
|
this.OverViewPathData = this.PathData;
|
124 |
|
|
this.OverViewText = this.Text;
|
125 |
|
|
this.OverViewPaint = this.Paint;
|
126 |
|
|
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
|
130 |
|
|
{
|
131 |
90e7968d
|
ljiyeon
|
|
132 |
|
|
|
133 |
787a4489
|
KangIngu
|
this.Text = Base_TextBox.Text;
|
134 |
|
|
|
135 |
|
|
BoxWidth = e.NewSize.Width;
|
136 |
|
|
BoxHeight = e.NewSize.Height;
|
137 |
|
|
|
138 |
|
|
this.ApplyTemplate();
|
139 |
|
|
|
140 |
|
|
DrawingCloud();
|
141 |
|
|
}
|
142 |
|
|
|
143 |
|
|
//void TextControl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
144 |
|
|
//{
|
145 |
|
|
// this.Focus();
|
146 |
|
|
//}
|
147 |
|
|
|
148 |
|
|
void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
|
149 |
|
|
{
|
150 |
b0fb3ad7
|
ljiyeon
|
if (Base_TextBox.Text.Contains("|OR||DZ|"))
|
151 |
|
|
{
|
152 |
|
|
Base_TextBox.Text = this.Text;
|
153 |
|
|
}
|
154 |
|
|
|
155 |
787a4489
|
KangIngu
|
this.Text = Base_TextBox.Text;
|
156 |
|
|
BoxWidth = e.NewSize.Width;
|
157 |
|
|
BoxHeight = e.NewSize.Height;
|
158 |
|
|
this.ApplyTemplate();
|
159 |
90e7968d
|
ljiyeon
|
DrawingCloud();
|
160 |
787a4489
|
KangIngu
|
}
|
161 |
|
|
|
162 |
|
|
void TextControl_GotFocus(object sender, RoutedEventArgs e)
|
163 |
|
|
{
|
164 |
|
|
if (EnableEditing)
|
165 |
|
|
{
|
166 |
|
|
IsEditing = true;
|
167 |
|
|
EditingMode();
|
168 |
|
|
}
|
169 |
|
|
else
|
170 |
|
|
{
|
171 |
|
|
IsEditing = false;
|
172 |
|
|
UnEditingMode();
|
173 |
|
|
}
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
void TextControl_LostFocus(object sender, RoutedEventArgs e)
|
177 |
|
|
{
|
178 |
|
|
IsEditing = false;
|
179 |
|
|
UnEditingMode();
|
180 |
|
|
ApplyOverViewData();
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
//void TextControl_GotFocus(object sender, RoutedEventArgs e)
|
184 |
|
|
//{
|
185 |
|
|
// Base_TextBox.Visibility = Visibility.Visible;
|
186 |
|
|
// Base_TextBlock.Visibility = Visibility.Collapsed;
|
187 |
|
|
// this.Base_TextBox.BorderThickness = new Thickness(1);
|
188 |
|
|
// if (UnderLine != null)
|
189 |
|
|
// {
|
190 |
|
|
// Base_TextBlock.TextDecorations = UnderLine;
|
191 |
|
|
// }
|
192 |
|
|
// if (this.Text != null)
|
193 |
|
|
// {
|
194 |
|
|
// Base_TextBox.Text = this.Text;
|
195 |
|
|
// }
|
196 |
|
|
// IsEditing = true;
|
197 |
|
|
//}
|
198 |
|
|
//void TextControl_LostFocus(object sender, RoutedEventArgs e)
|
199 |
|
|
//{
|
200 |
|
|
// Base_TextBox.Visibility = Visibility.Collapsed;
|
201 |
|
|
// Base_TextBlock.Visibility = Visibility.Visible;
|
202 |
|
|
// this.Text = Base_TextBox.Text;
|
203 |
|
|
// if (UnderLine != null)
|
204 |
|
|
// {
|
205 |
|
|
// Base_TextBlock.TextDecorations = UnderLine;
|
206 |
|
|
// }
|
207 |
|
|
// Base_TextBlock.Margin =
|
208 |
|
|
// new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4, Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
|
209 |
|
|
// IsEditing = false;
|
210 |
|
|
//}
|
211 |
|
|
|
212 |
|
|
public void EditingMode()
|
213 |
|
|
{
|
214 |
2aac9b2b
|
djkim
|
//System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString());
|
215 |
787a4489
|
KangIngu
|
TextBoxVisibility = Visibility.Visible;
|
216 |
|
|
//Base_TextBox.Visibility = System.Windows.Visibility.Visible;
|
217 |
|
|
|
218 |
|
|
TextBlockVisibility = Visibility.Collapsed;
|
219 |
|
|
//Base_TextBlock.Visibility = System.Windows.Visibility.Collapsed;
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
//this.Base_TextBox.BorderThickness = new Thickness(1);
|
223 |
|
|
|
224 |
|
|
if (UnderLine != null)
|
225 |
|
|
Base_TextBlock.TextDecorations = UnderLine;
|
226 |
|
|
|
227 |
|
|
if (this.Text != null)
|
228 |
|
|
Base_TextBox.Text = this.Text;
|
229 |
|
|
|
230 |
|
|
// Base_TextBox.Margin =
|
231 |
|
|
//new Thickness(Base_TextBlock.Margin.Left + -2, Base_TextBlock.Margin.Top + 0,
|
232 |
|
|
//Base_TextBlock.Margin.Right + 0, Base_TextBlock.Margin.Bottom + -2);
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
public void UnEditingMode()
|
236 |
|
|
{
|
237 |
|
|
if (EnableEditing)
|
238 |
|
|
this.Text = Base_TextBox.Text;
|
239 |
|
|
|
240 |
|
|
TextBoxVisibility = Visibility.Collapsed;
|
241 |
|
|
//Base_TextBox.Visibility = System.Windows.Visibility.Collapsed;
|
242 |
|
|
|
243 |
|
|
TextBlockVisibility = Visibility.Visible;
|
244 |
|
|
//Base_TextBlock.Visibility = System.Windows.Visibility.Visible;
|
245 |
|
|
|
246 |
|
|
if (UnderLine != null)
|
247 |
|
|
Base_TextBlock.TextDecorations = UnderLine;
|
248 |
|
|
|
249 |
|
|
//Base_TextBox.Focusable = false;
|
250 |
|
|
|
251 |
|
|
//Base_TextBlock.Margin =
|
252 |
|
|
// new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4,
|
253 |
|
|
// Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
|
254 |
|
|
|
255 |
|
|
// Base_TextBlock.Margin =
|
256 |
|
|
//new Thickness(Base_TextBox.Margin.Left + 2, Base_TextBox.Margin.Top + 2,
|
257 |
|
|
// Base_TextBox.Margin.Right + 2, Base_TextBox.Margin.Bottom + 2);
|
258 |
|
|
|
259 |
|
|
// Base_TextBlock.Margin =
|
260 |
|
|
//new Thickness(Base_TextBox.Margin.Left + 5, Base_TextBox.Margin.Top + 0,
|
261 |
|
|
//Base_TextBox.Margin.Right + 0, Base_TextBox.Margin.Bottom + 2);
|
262 |
|
|
}
|
263 |
|
|
|
264 |
|
|
public void SetText()
|
265 |
|
|
{
|
266 |
|
|
this.ApplyTemplate();
|
267 |
|
|
if (IsHighLight)
|
268 |
|
|
{
|
269 |
|
|
this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
|
270 |
|
|
Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
|
271 |
|
|
this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
|
272 |
|
|
Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B));
|
273 |
|
|
}
|
274 |
|
|
else
|
275 |
|
|
{
|
276 |
|
|
this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
|
277 |
|
|
Colors.White.R, Colors.White.G, Colors.White.B));
|
278 |
|
|
|
279 |
|
|
this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.1),
|
280 |
|
|
Colors.White.R, Colors.White.G, Colors.White.B));
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
//this.BackColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
|
284 |
|
|
// Colors.White.R, Colors.White.G, Colors.White.B));
|
285 |
|
|
//this.BackColor = null;
|
286 |
|
|
}
|
287 |
|
|
if (Base_TextPath != null)
|
288 |
|
|
{
|
289 |
|
|
Base_TextPath.StrokeThickness = LineSize.Left;
|
290 |
|
|
}
|
291 |
|
|
|
292 |
|
|
OverViewPathData = PathData;
|
293 |
|
|
OverViewText = Text;
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
public void DrawingCloud()
|
297 |
|
|
{
|
298 |
|
|
this.ApplyTemplate();
|
299 |
|
|
|
300 |
|
|
//pathGeometry = new PathGeometry();
|
301 |
|
|
|
302 |
|
|
List<Point> pCloud = new List<Point>
|
303 |
|
|
{
|
304 |
|
|
//new Point(0, 0),
|
305 |
|
|
//new Point(0, 0 + BoxHeight + 2),
|
306 |
|
|
//new Point(0 + BoxWidth + 4, 0 + BoxHeight + 2),
|
307 |
|
|
//new Point(0 + BoxWidth + 4 ,0),
|
308 |
|
|
//new Point(0, 0)
|
309 |
|
|
|
310 |
|
|
new Point(0, 0),
|
311 |
|
|
new Point(0, 0 + BoxHeight + 0),
|
312 |
|
|
new Point(0 + BoxWidth + 2, 0 + BoxHeight + 0),
|
313 |
|
|
new Point(0 + BoxWidth + 2 ,0),
|
314 |
|
|
new Point(0, 0)
|
315 |
|
|
};
|
316 |
|
|
|
317 |
|
|
if (Base_TextPath != null)
|
318 |
|
|
{
|
319 |
|
|
switch (ControlType_No)
|
320 |
|
|
{
|
321 |
|
|
case 0:
|
322 |
|
|
{
|
323 |
|
|
PathData = new PathGeometry();
|
324 |
|
|
PathDataInner = (GenerateInner(pCloud));
|
325 |
|
|
}
|
326 |
|
|
break;
|
327 |
|
|
case 1:
|
328 |
|
|
{
|
329 |
|
|
PathData = (Generate_Rect(pCloud));
|
330 |
|
|
|
331 |
|
|
List<Point> pCloud2 = new List<Point>
|
332 |
|
|
{
|
333 |
|
|
//new Point(0, 0),
|
334 |
|
|
//new Point(0, 0 + BoxHeight + 2),
|
335 |
|
|
//new Point(0 + BoxWidth + 4, 0 + BoxHeight + 2),
|
336 |
|
|
//new Point(0 + BoxWidth + 4 ,0),
|
337 |
|
|
//new Point(0, 0)
|
338 |
|
|
|
339 |
|
|
new Point(0, 0),
|
340 |
|
|
new Point(0, 0 + BoxHeight + 0),
|
341 |
|
|
new Point(0 + BoxWidth + 10, 0 + BoxHeight + 0),
|
342 |
|
|
new Point(0 + BoxWidth + 10 ,0),
|
343 |
|
|
new Point(0, 0)
|
344 |
|
|
};
|
345 |
|
|
|
346 |
|
|
PathDataInner = (GenerateInner(pCloud));
|
347 |
|
|
}
|
348 |
|
|
break;
|
349 |
|
|
case 2:
|
350 |
|
|
{
|
351 |
|
|
PathData = (Generate(pCloud));
|
352 |
|
|
PathDataInner = (GenerateInner(pCloud));
|
353 |
|
|
}
|
354 |
|
|
break;
|
355 |
|
|
}
|
356 |
|
|
}
|
357 |
|
|
|
358 |
|
|
SetText();
|
359 |
|
|
}
|
360 |
|
|
#endregion Internal Method
|
361 |
|
|
|
362 |
|
|
public void Dispose()
|
363 |
|
|
{
|
364 |
|
|
GC.Collect();
|
365 |
|
|
GC.SuppressFinalize(this);
|
366 |
|
|
}
|
367 |
|
|
public void updateControl()
|
368 |
|
|
{
|
369 |
|
|
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y);
|
370 |
|
|
this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y);
|
371 |
|
|
}
|
372 |
|
|
|
373 |
|
|
#region Drawing Cloud Method
|
374 |
|
|
public static PathGeometry Generate_Rect(List<Point> pData)
|
375 |
|
|
{
|
376 |
|
|
//this.StartPoint;
|
377 |
|
|
|
378 |
|
|
PathFigure pathFigure = new PathFigure();
|
379 |
|
|
pathFigure.StartPoint = pData[0];
|
380 |
|
|
|
381 |
|
|
LineSegment lineSegment0 = new LineSegment();
|
382 |
|
|
lineSegment0.Point = pData[0];
|
383 |
|
|
pathFigure.Segments.Add(lineSegment0);
|
384 |
|
|
|
385 |
|
|
LineSegment lineSegment1 = new LineSegment();
|
386 |
|
|
lineSegment1.Point = pData[1];
|
387 |
|
|
pathFigure.Segments.Add(lineSegment1);
|
388 |
|
|
|
389 |
|
|
LineSegment lineSegment2 = new LineSegment();
|
390 |
|
|
lineSegment2.Point = pData[2];
|
391 |
|
|
pathFigure.Segments.Add(lineSegment2);
|
392 |
|
|
|
393 |
|
|
LineSegment lineSegment3 = new LineSegment();
|
394 |
|
|
lineSegment3.Point = pData[3];
|
395 |
|
|
pathFigure.Segments.Add(lineSegment3);
|
396 |
|
|
|
397 |
|
|
PathGeometry rectPathGeometry = new PathGeometry();
|
398 |
|
|
rectPathGeometry.Figures = new PathFigureCollection();
|
399 |
|
|
pathFigure.IsClosed = true;
|
400 |
|
|
pathFigure.IsFilled = false;
|
401 |
|
|
rectPathGeometry.Figures.Add(pathFigure);
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
return rectPathGeometry;
|
405 |
|
|
}
|
406 |
|
|
|
407 |
|
|
public static PathGeometry Generate(List<Point> pData)
|
408 |
|
|
{
|
409 |
|
|
var _pathGeometry = new PathGeometry();
|
410 |
|
|
double area = MathSet.AreaOf(pData);
|
411 |
|
|
bool reverse = (area > 0);
|
412 |
|
|
int count = pData.Count;
|
413 |
|
|
for (int i = 0; i < (count - 1); i++)
|
414 |
|
|
{
|
415 |
|
|
PathFigure pathFigure = GenerateLineWithCloud(pData[i], pData[i + 1], 20, reverse);
|
416 |
|
|
pathFigure.IsClosed = false;
|
417 |
|
|
pathFigure.IsFilled = true;
|
418 |
|
|
_pathGeometry.Figures.Add(pathFigure);
|
419 |
|
|
}
|
420 |
|
|
|
421 |
|
|
// PathFigure pathFigur2= new PathFigure();
|
422 |
|
|
//pathFigur2.StartPoint = pData[0];
|
423 |
|
|
|
424 |
|
|
// LineSegment lineSegment0 = new LineSegment();
|
425 |
|
|
// lineSegment0.Point = pData[0];
|
426 |
|
|
//pathFigur2.Segments.Add(lineSegment0);
|
427 |
|
|
|
428 |
|
|
// LineSegment lineSegment1 = new LineSegment();
|
429 |
|
|
// lineSegment1.Point = pData[1];
|
430 |
|
|
//pathFigur2.Segments.Add(lineSegment1);
|
431 |
|
|
|
432 |
|
|
// LineSegment lineSegment2 = new LineSegment();
|
433 |
|
|
// lineSegment2.Point = pData[2];
|
434 |
|
|
//pathFigur2.Segments.Add(lineSegment2);
|
435 |
|
|
|
436 |
|
|
// LineSegment lineSegment3 = new LineSegment();
|
437 |
|
|
// lineSegment3.Point = pData[3];
|
438 |
|
|
//pathFigur2.Segments.Add(lineSegment3);
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
//pathFigur2.IsClosed = true;
|
442 |
|
|
//pathFigur2.IsFilled = true;
|
443 |
|
|
//_pathGeometry.Figures.Add(pathFigur2);
|
444 |
|
|
|
445 |
|
|
return _pathGeometry;
|
446 |
|
|
}
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
public static PathGeometry GenerateInner(List<Point> pData)
|
450 |
|
|
{
|
451 |
|
|
var _pathGeometry = new PathGeometry();
|
452 |
|
|
double area = MathSet.AreaOf(pData);
|
453 |
|
|
bool reverse = (area > 0);
|
454 |
|
|
int count = pData.Count;
|
455 |
|
|
|
456 |
|
|
PathFigure pathFigur2 = new PathFigure();
|
457 |
|
|
pathFigur2.StartPoint = pData[0];
|
458 |
|
|
|
459 |
|
|
LineSegment lineSegment0 = new LineSegment();
|
460 |
|
|
lineSegment0.Point = pData[0];
|
461 |
|
|
pathFigur2.Segments.Add(lineSegment0);
|
462 |
|
|
|
463 |
|
|
LineSegment lineSegment1 = new LineSegment();
|
464 |
|
|
lineSegment1.Point = pData[1];
|
465 |
|
|
pathFigur2.Segments.Add(lineSegment1);
|
466 |
|
|
|
467 |
|
|
LineSegment lineSegment2 = new LineSegment();
|
468 |
|
|
lineSegment2.Point = pData[2];
|
469 |
|
|
pathFigur2.Segments.Add(lineSegment2);
|
470 |
|
|
|
471 |
|
|
LineSegment lineSegment3 = new LineSegment();
|
472 |
|
|
lineSegment3.Point = pData[3];
|
473 |
|
|
pathFigur2.Segments.Add(lineSegment3);
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
pathFigur2.IsClosed = true;
|
477 |
|
|
pathFigur2.IsFilled = true;
|
478 |
|
|
_pathGeometry.Figures.Add(pathFigur2);
|
479 |
|
|
|
480 |
|
|
return _pathGeometry;
|
481 |
|
|
}
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
|
485 |
|
|
public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double _arcLength, bool reverse)
|
486 |
|
|
{
|
487 |
|
|
PathFigure pathFigure = new PathFigure();
|
488 |
|
|
pathFigure.StartPoint = p1;
|
489 |
|
|
|
490 |
|
|
double arcLength = _arcLength;
|
491 |
|
|
double dx = p2.X - p1.X;
|
492 |
|
|
double dy = p2.Y - p1.Y;
|
493 |
|
|
double l = MathSet.DistanceTo(p1, p2);
|
494 |
|
|
double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI;
|
495 |
|
|
Point lastPt = new Point(p1.X, p1.Y);
|
496 |
|
|
double count = l / _arcLength;
|
497 |
|
|
|
498 |
|
|
dx /= l;
|
499 |
|
|
dy /= l;
|
500 |
|
|
|
501 |
|
|
Double j = 1;
|
502 |
|
|
for (j = 1; j < (count - 1); j++)
|
503 |
|
|
{
|
504 |
|
|
ArcSegment arcSeg = new ArcSegment();
|
505 |
5a9353a9
|
humkyung
|
arcSeg.Size = new Size(arcLength * TextControl._CloudArcDepth, arcLength * TextControl._CloudArcDepth);
|
506 |
787a4489
|
KangIngu
|
arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength);
|
507 |
|
|
lastPt = arcSeg.Point;
|
508 |
|
|
arcSeg.RotationAngle = theta + 90;
|
509 |
|
|
if (true == reverse)
|
510 |
|
|
arcSeg.SweepDirection = SweepDirection.Clockwise;
|
511 |
|
|
pathFigure.Segments.Add(arcSeg);
|
512 |
|
|
}
|
513 |
|
|
|
514 |
|
|
if ((count > j) || count > 0)
|
515 |
|
|
{
|
516 |
|
|
arcLength = MathSet.DistanceTo(lastPt, p2);
|
517 |
|
|
ArcSegment arcSeg = new ArcSegment();
|
518 |
5a9353a9
|
humkyung
|
arcSeg.Size = new Size(arcLength * TextControl._CloudArcDepth, arcLength * TextControl._CloudArcDepth);
|
519 |
787a4489
|
KangIngu
|
arcSeg.Point = new Point(p2.X, p2.Y);
|
520 |
|
|
arcSeg.RotationAngle = theta;
|
521 |
|
|
|
522 |
|
|
if (true == reverse)
|
523 |
|
|
arcSeg.SweepDirection = SweepDirection.Clockwise;
|
524 |
|
|
|
525 |
|
|
pathFigure.Segments.Add(arcSeg);
|
526 |
|
|
|
527 |
|
|
}
|
528 |
|
|
return pathFigure;
|
529 |
|
|
}
|
530 |
|
|
#endregion
|
531 |
|
|
|
532 |
|
|
#region Dependency Properties
|
533 |
|
|
public static readonly DependencyProperty ControlTypeProperty =
|
534 |
|
|
DependencyProperty.Register("ControlType", typeof(ControlType), typeof(TextControl), new FrameworkPropertyMetadata(ControlType.TextControl));
|
535 |
|
|
|
536 |
|
|
public static readonly DependencyProperty ControlType_NoProperty =
|
537 |
|
|
DependencyProperty.Register("ControlType_No", typeof(int), typeof(TextControl), new FrameworkPropertyMetadata(0));
|
538 |
|
|
|
539 |
|
|
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
|
540 |
|
|
"IsSelected", typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(false, IsSelectedChanged));
|
541 |
|
|
|
542 |
|
|
public static readonly DependencyProperty PathGeometryProperty = DependencyProperty.Register(
|
543 |
|
|
"PathGeometry", typeof(PathGeometry), typeof(TextControl), new PropertyMetadata(null, SetPathGeometryChanged));
|
544 |
|
|
|
545 |
|
|
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
546 |
|
|
"Text", typeof(string), typeof(TextControl), new PropertyMetadata(null));
|
547 |
|
|
|
548 |
|
|
public static readonly DependencyProperty OverViewTextProperty = DependencyProperty.Register(
|
549 |
|
|
"OverViewText", typeof(string), typeof(TextControl), new PropertyMetadata(null));
|
550 |
|
|
|
551 |
|
|
public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register(
|
552 |
|
|
"UserID", typeof(string), typeof(TextControl), new PropertyMetadata(null));
|
553 |
|
|
|
554 |
|
|
public static readonly DependencyProperty FontColorProperty = DependencyProperty.Register(
|
555 |
|
|
"FontColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.Red)));
|
556 |
|
|
|
557 |
|
|
//강인구 추가
|
558 |
|
|
public static readonly DependencyProperty IsHighlightProperty = DependencyProperty.Register(
|
559 |
|
|
"IsHighLight", typeof(bool), typeof(TextControl), new PropertyMetadata(false, PointValueChanged));
|
560 |
|
|
|
561 |
|
|
public static readonly DependencyProperty BackColorProperty = DependencyProperty.Register(
|
562 |
|
|
"BackColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
|
563 |
|
|
|
564 |
|
|
public static readonly DependencyProperty BackInnerColorProperty = DependencyProperty.Register(
|
565 |
|
|
"BackInnerColor", typeof(SolidColorBrush), typeof(TextControl), new PropertyMetadata(new SolidColorBrush(Colors.White)));
|
566 |
|
|
|
567 |
|
|
public static readonly DependencyProperty UnderLineProperty = DependencyProperty.Register(
|
568 |
|
|
"UnderLine", typeof(TextDecorationCollection), typeof(TextControl), new PropertyMetadata(null));
|
569 |
|
|
|
570 |
|
|
public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register(
|
571 |
f8769f8a
|
ljiyeon
|
"LineSize", typeof(Thickness), typeof(TextControl), new PropertyMetadata(new Thickness(4), PointValueChanged)); //여기만 4인지 모르겠지만 4 그대로 두겠음
|
572 |
787a4489
|
KangIngu
|
|
573 |
|
|
public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register(
|
574 |
|
|
"PointSet", typeof(List<Point>), typeof(TextControl), new PropertyMetadata(new List<Point>()));
|
575 |
|
|
|
576 |
|
|
public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
|
577 |
|
|
"PathData", typeof(Geometry), typeof(TextControl), null);
|
578 |
|
|
|
579 |
|
|
public static readonly DependencyProperty PathDataInnerProperty = DependencyProperty.Register(
|
580 |
|
|
"PathDataInner", typeof(Geometry), typeof(TextControl), null);
|
581 |
|
|
|
582 |
|
|
public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register(
|
583 |
|
|
"OverViewPathDataProperty", typeof(Geometry), typeof(TextControl), null);
|
584 |
|
|
|
585 |
|
|
public static readonly DependencyProperty TextStyleProperty = DependencyProperty.Register(
|
586 |
|
|
"TextStyle", typeof(FontStyle), typeof(TextControl), new PropertyMetadata(FontStyles.Normal));
|
587 |
|
|
|
588 |
|
|
public static readonly DependencyProperty TextFamilyProperty = DependencyProperty.Register(
|
589 |
|
|
"TextFamily", typeof(FontFamily), typeof(TextControl), new PropertyMetadata(new FontFamily("Arial")));
|
590 |
|
|
|
591 |
|
|
public static readonly DependencyProperty TextWeightProperty = DependencyProperty.Register(
|
592 |
|
|
"TextWeight", typeof(FontWeight), typeof(TextControl), new PropertyMetadata(FontWeights.Normal));
|
593 |
|
|
|
594 |
|
|
public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(
|
595 |
|
|
"CenterX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
|
596 |
|
|
|
597 |
|
|
public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(
|
598 |
|
|
"CenterY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnCenterXYChanged));
|
599 |
|
|
|
600 |
|
|
public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register(
|
601 |
|
|
"CanvasX", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
|
602 |
|
|
|
603 |
|
|
public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register(
|
604 |
|
|
"CanvasY", typeof(double), typeof(TextControl), new PropertyMetadata((double)0, OnSetCansvasChanged));
|
605 |
|
|
|
606 |
|
|
public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
|
607 |
|
|
"StartPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(0, 0), PointValueChanged));
|
608 |
|
|
|
609 |
|
|
public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register(
|
610 |
|
|
"EndPoint", typeof(Point), typeof(TextControl), new PropertyMetadata(new Point(100, 100), PointValueChanged));
|
611 |
|
|
|
612 |
|
|
public static readonly DependencyProperty TextSizeProperty = DependencyProperty.Register(
|
613 |
|
|
"TextSize", typeof(Double), typeof(TextControl), new PropertyMetadata((Double)30, PointValueChanged));
|
614 |
|
|
|
615 |
|
|
public static readonly DependencyProperty PaintProperty = DependencyProperty.Register(
|
616 |
|
|
"Paint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
|
617 |
|
|
|
618 |
|
|
public static readonly DependencyProperty OverViewPaintProperty = DependencyProperty.Register(
|
619 |
|
|
"OverViewPaint", typeof(PaintSet), typeof(TextControl), new PropertyMetadata((PaintSet.None), PointValueChanged));
|
620 |
|
|
|
621 |
|
|
public static readonly DependencyProperty AngleProperty = DependencyProperty.Register(
|
622 |
|
|
"Angle", typeof(double), typeof(TextControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged)));
|
623 |
|
|
|
624 |
|
|
public static readonly DependencyProperty IsEditingProperty = DependencyProperty.Register(
|
625 |
|
|
"IsEditing", typeof(bool), typeof(TextControl), new PropertyMetadata((false), new PropertyChangedCallback(OnIsEditingChanged)));
|
626 |
|
|
|
627 |
|
|
public static readonly DependencyProperty EnableEditingProperty = DependencyProperty.Register(
|
628 |
|
|
"EnableEditing", typeof(bool), typeof(TextControl), new PropertyMetadata((true)));
|
629 |
|
|
|
630 |
|
|
public static readonly DependencyProperty TextBoxVisibilityProperty = DependencyProperty.Register(
|
631 |
|
|
"TextBoxVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Visible), OnTextBoxVisibilityChanged));
|
632 |
|
|
|
633 |
|
|
public static readonly DependencyProperty TextBlockVisibilityProperty = DependencyProperty.Register(
|
634 |
|
|
"TextBlockVisibility", typeof(Visibility), typeof(TextControl), new PropertyMetadata((Visibility.Collapsed), OnTextBlockVisibilityChanged));
|
635 |
|
|
|
636 |
|
|
#endregion Dependency Properties
|
637 |
|
|
|
638 |
|
|
#region dp Properties
|
639 |
|
|
|
640 |
|
|
public bool IsEditing
|
641 |
|
|
{
|
642 |
|
|
get { return (bool)GetValue(IsEditingProperty); }
|
643 |
|
|
set
|
644 |
|
|
{
|
645 |
|
|
if (this.IsEditing != value)
|
646 |
|
|
{
|
647 |
|
|
SetValue(IsEditingProperty, value);
|
648 |
|
|
|
649 |
|
|
OnPropertyChanged("IsEditing");
|
650 |
|
|
|
651 |
|
|
}
|
652 |
|
|
}
|
653 |
|
|
}
|
654 |
|
|
|
655 |
|
|
public bool EnableEditing
|
656 |
|
|
{
|
657 |
|
|
get { return (bool)GetValue(EnableEditingProperty); }
|
658 |
|
|
set
|
659 |
|
|
{
|
660 |
|
|
if (this.EnableEditing != value)
|
661 |
|
|
{
|
662 |
|
|
SetValue(EnableEditingProperty, value);
|
663 |
|
|
OnPropertyChanged("EnableEditing");
|
664 |
|
|
}
|
665 |
|
|
}
|
666 |
|
|
}
|
667 |
|
|
|
668 |
|
|
public Thickness LineSize
|
669 |
|
|
{
|
670 |
|
|
get
|
671 |
|
|
{
|
672 |
|
|
return (Thickness)GetValue(LineSizeProperty);
|
673 |
|
|
}
|
674 |
|
|
set
|
675 |
|
|
{
|
676 |
|
|
if (this.LineSize != value)
|
677 |
|
|
{
|
678 |
|
|
SetValue(LineSizeProperty, value);
|
679 |
|
|
OnPropertyChanged("LineSize");
|
680 |
|
|
}
|
681 |
|
|
}
|
682 |
|
|
}
|
683 |
|
|
|
684 |
|
|
|
685 |
|
|
|
686 |
|
|
|
687 |
|
|
public ControlType ControlType
|
688 |
|
|
{
|
689 |
|
|
get
|
690 |
|
|
{
|
691 |
|
|
return (ControlType)GetValue(ControlTypeProperty);
|
692 |
|
|
}
|
693 |
|
|
set
|
694 |
|
|
{
|
695 |
|
|
SetValue(ControlTypeProperty, value);
|
696 |
|
|
}
|
697 |
|
|
}
|
698 |
|
|
public int ControlType_No
|
699 |
|
|
{
|
700 |
|
|
get
|
701 |
|
|
{
|
702 |
|
|
return (int)GetValue(ControlType_NoProperty);
|
703 |
|
|
}
|
704 |
|
|
set
|
705 |
|
|
{
|
706 |
|
|
SetValue(ControlType_NoProperty, value);
|
707 |
|
|
}
|
708 |
|
|
}
|
709 |
|
|
|
710 |
|
|
public string UserID
|
711 |
|
|
{
|
712 |
|
|
get { return (string)GetValue(UserIDProperty); }
|
713 |
|
|
set
|
714 |
|
|
{
|
715 |
|
|
if (this.UserID != value)
|
716 |
|
|
{
|
717 |
|
|
SetValue(UserIDProperty, value);
|
718 |
|
|
OnPropertyChanged("UserID");
|
719 |
|
|
}
|
720 |
|
|
}
|
721 |
|
|
}
|
722 |
|
|
|
723 |
|
|
public double CenterX
|
724 |
|
|
{
|
725 |
|
|
get { return (double)GetValue(CenterXProperty); }
|
726 |
|
|
set { SetValue(CenterXProperty, value);
|
727 |
|
|
OnPropertyChanged("CenterX");
|
728 |
|
|
|
729 |
|
|
}
|
730 |
|
|
}
|
731 |
|
|
|
732 |
|
|
public double CenterY
|
733 |
|
|
{
|
734 |
|
|
get { return (double)GetValue(CenterYProperty); }
|
735 |
|
|
set { SetValue(CenterYProperty, value);
|
736 |
|
|
OnPropertyChanged("CenterY");
|
737 |
|
|
}
|
738 |
|
|
}
|
739 |
|
|
|
740 |
|
|
public string Text
|
741 |
|
|
{
|
742 |
|
|
get { return (string)GetValue(TextProperty); }
|
743 |
|
|
set
|
744 |
|
|
{
|
745 |
|
|
if (this.Text != value)
|
746 |
|
|
{
|
747 |
|
|
SetValue(TextProperty, value);
|
748 |
|
|
OnPropertyChanged("Text");
|
749 |
|
|
}
|
750 |
|
|
}
|
751 |
|
|
}
|
752 |
|
|
|
753 |
|
|
public string OverViewText
|
754 |
|
|
{
|
755 |
|
|
get { return (string)GetValue(OverViewTextProperty); }
|
756 |
|
|
set
|
757 |
|
|
{
|
758 |
|
|
if (this.OverViewText != value)
|
759 |
|
|
{
|
760 |
|
|
SetValue(OverViewTextProperty, value);
|
761 |
|
|
OnPropertyChanged("OverViewText");
|
762 |
|
|
}
|
763 |
|
|
}
|
764 |
|
|
}
|
765 |
|
|
|
766 |
|
|
public Geometry OverViewPathData
|
767 |
|
|
{
|
768 |
|
|
get { return (Geometry)GetValue(OverViewPathDataProperty); }
|
769 |
|
|
set
|
770 |
|
|
{
|
771 |
|
|
if (this.OverViewPathData != value)
|
772 |
|
|
{
|
773 |
|
|
SetValue(OverViewPathDataProperty, value);
|
774 |
|
|
OnPropertyChanged("OverViewPathData");
|
775 |
|
|
}
|
776 |
|
|
}
|
777 |
|
|
}
|
778 |
|
|
|
779 |
|
|
public Visibility TextBoxVisibility
|
780 |
|
|
{
|
781 |
|
|
get { return (Visibility)GetValue(TextBoxVisibilityProperty); }
|
782 |
|
|
set
|
783 |
|
|
{
|
784 |
|
|
if (this.TextBoxVisibility != value)
|
785 |
|
|
{
|
786 |
|
|
SetValue(TextBoxVisibilityProperty, value);
|
787 |
|
|
OnPropertyChanged("TextBoxVisibility");
|
788 |
|
|
}
|
789 |
|
|
}
|
790 |
|
|
}
|
791 |
|
|
|
792 |
|
|
|
793 |
|
|
public Visibility TextBlockVisibility
|
794 |
|
|
{
|
795 |
|
|
get { return (Visibility)GetValue(TextBlockVisibilityProperty); }
|
796 |
|
|
set
|
797 |
|
|
{
|
798 |
|
|
if (this.TextBlockVisibility != value)
|
799 |
|
|
{
|
800 |
|
|
SetValue(TextBlockVisibilityProperty, value);
|
801 |
|
|
OnPropertyChanged("TextBlockVisibility");
|
802 |
|
|
}
|
803 |
|
|
}
|
804 |
|
|
}
|
805 |
|
|
|
806 |
|
|
|
807 |
|
|
|
808 |
|
|
public Double TextSize
|
809 |
|
|
{
|
810 |
|
|
get { return (Double)GetValue(TextSizeProperty); }
|
811 |
|
|
set
|
812 |
|
|
{
|
813 |
|
|
if (this.TextSize != value)
|
814 |
|
|
{
|
815 |
|
|
SetValue(TextSizeProperty, value);
|
816 |
|
|
OnPropertyChanged("TextSize");
|
817 |
|
|
}
|
818 |
|
|
}
|
819 |
|
|
}
|
820 |
|
|
|
821 |
|
|
public SolidColorBrush FontColor
|
822 |
|
|
{
|
823 |
|
|
get { return (SolidColorBrush)GetValue(FontColorProperty); }
|
824 |
|
|
set
|
825 |
|
|
{
|
826 |
|
|
if (this.FontColor != value)
|
827 |
|
|
{
|
828 |
|
|
SetValue(FontColorProperty, value);
|
829 |
|
|
OnPropertyChanged("FontColor");
|
830 |
|
|
}
|
831 |
|
|
}
|
832 |
|
|
}
|
833 |
|
|
|
834 |
|
|
public SolidColorBrush BackColor
|
835 |
|
|
{
|
836 |
|
|
get { return (SolidColorBrush)GetValue(BackColorProperty); }
|
837 |
|
|
set
|
838 |
|
|
{
|
839 |
|
|
if (this.BackColor != value)
|
840 |
|
|
{
|
841 |
|
|
SetValue(BackColorProperty, value);
|
842 |
|
|
OnPropertyChanged("BackColor");
|
843 |
|
|
}
|
844 |
|
|
}
|
845 |
|
|
}
|
846 |
|
|
|
847 |
|
|
public SolidColorBrush BackInnerColor
|
848 |
|
|
{
|
849 |
|
|
get { return (SolidColorBrush)GetValue(BackInnerColorProperty); }
|
850 |
|
|
set
|
851 |
|
|
{
|
852 |
|
|
if (this.BackInnerColor != value)
|
853 |
|
|
{
|
854 |
|
|
SetValue(BackInnerColorProperty, value);
|
855 |
|
|
OnPropertyChanged("BackInnerColor");
|
856 |
|
|
}
|
857 |
|
|
}
|
858 |
|
|
}
|
859 |
|
|
|
860 |
|
|
|
861 |
|
|
|
862 |
|
|
public TextDecorationCollection UnderLine
|
863 |
|
|
{
|
864 |
|
|
get
|
865 |
|
|
{
|
866 |
|
|
return (TextDecorationCollection)GetValue(UnderLineProperty);
|
867 |
|
|
}
|
868 |
|
|
set
|
869 |
|
|
{
|
870 |
|
|
if (this.UnderLine != value)
|
871 |
|
|
{
|
872 |
|
|
SetValue(UnderLineProperty, value);
|
873 |
|
|
OnPropertyChanged("UnderLine");
|
874 |
|
|
}
|
875 |
|
|
}
|
876 |
|
|
}
|
877 |
|
|
|
878 |
|
|
public double CanvasX
|
879 |
|
|
{
|
880 |
|
|
get { return (double)GetValue(CanvasXProperty); }
|
881 |
|
|
set
|
882 |
|
|
{
|
883 |
|
|
if (this.CanvasX != value)
|
884 |
|
|
{
|
885 |
|
|
SetValue(CanvasXProperty, value);
|
886 |
|
|
OnPropertyChanged("CanvasX");
|
887 |
|
|
}
|
888 |
|
|
}
|
889 |
|
|
}
|
890 |
|
|
|
891 |
|
|
public double CanvasY
|
892 |
|
|
{
|
893 |
|
|
get { return (double)GetValue(CanvasYProperty); }
|
894 |
|
|
set
|
895 |
|
|
{
|
896 |
|
|
if (this.CanvasY != value)
|
897 |
|
|
{
|
898 |
|
|
SetValue(CanvasYProperty, value);
|
899 |
|
|
OnPropertyChanged("CanvasY");
|
900 |
|
|
}
|
901 |
|
|
}
|
902 |
|
|
}
|
903 |
|
|
|
904 |
|
|
public Point EndPoint
|
905 |
|
|
{
|
906 |
|
|
get { return (Point)GetValue(EndPointProperty); }
|
907 |
|
|
set
|
908 |
|
|
{
|
909 |
|
|
if (this.EndPoint != value)
|
910 |
|
|
{
|
911 |
|
|
SetValue(EndPointProperty, value);
|
912 |
|
|
OnPropertyChanged("EndPoint");
|
913 |
|
|
}
|
914 |
|
|
}
|
915 |
|
|
}
|
916 |
|
|
|
917 |
|
|
public Point StartPoint
|
918 |
|
|
{
|
919 |
|
|
get { return (Point)GetValue(StartPointProperty); }
|
920 |
|
|
set
|
921 |
|
|
{
|
922 |
|
|
if (this.StartPoint != value)
|
923 |
|
|
{
|
924 |
|
|
SetValue(StartPointProperty, value);
|
925 |
|
|
OnPropertyChanged("StartPoint");
|
926 |
|
|
}
|
927 |
|
|
}
|
928 |
|
|
}
|
929 |
|
|
|
930 |
|
|
public FontStyle TextStyle
|
931 |
|
|
{
|
932 |
|
|
get { return (FontStyle)GetValue(TextStyleProperty); }
|
933 |
|
|
set
|
934 |
|
|
{
|
935 |
|
|
if (this.TextStyle != value)
|
936 |
|
|
{
|
937 |
|
|
SetValue(TextStyleProperty, value);
|
938 |
|
|
OnPropertyChanged("TextStyle");
|
939 |
|
|
}
|
940 |
|
|
}
|
941 |
|
|
}
|
942 |
|
|
|
943 |
|
|
public FontFamily TextFamily
|
944 |
|
|
{
|
945 |
|
|
get { return (FontFamily)GetValue(TextFamilyProperty); }
|
946 |
|
|
set
|
947 |
|
|
{
|
948 |
|
|
if (this.TextFamily != value)
|
949 |
|
|
{
|
950 |
|
|
SetValue(TextFamilyProperty, value);
|
951 |
|
|
OnPropertyChanged("TextFamily");
|
952 |
|
|
}
|
953 |
|
|
}
|
954 |
|
|
}
|
955 |
|
|
|
956 |
|
|
public FontWeight TextWeight
|
957 |
|
|
{
|
958 |
|
|
get { return (FontWeight)GetValue(TextWeightProperty); }
|
959 |
|
|
set
|
960 |
|
|
{
|
961 |
|
|
if (this.TextWeight != value)
|
962 |
|
|
{
|
963 |
|
|
SetValue(TextWeightProperty, value);
|
964 |
|
|
OnPropertyChanged("TextWeight");
|
965 |
|
|
}
|
966 |
|
|
}
|
967 |
|
|
}
|
968 |
|
|
|
969 |
|
|
public PaintSet Paint
|
970 |
|
|
{
|
971 |
|
|
get { return (PaintSet)GetValue(PaintProperty); }
|
972 |
|
|
set
|
973 |
|
|
{
|
974 |
|
|
if (this.Paint != value)
|
975 |
|
|
{
|
976 |
|
|
SetValue(PaintProperty, value);
|
977 |
|
|
OnPropertyChanged("Paint");
|
978 |
|
|
}
|
979 |
|
|
}
|
980 |
|
|
}
|
981 |
|
|
|
982 |
|
|
public PaintSet OverViewPaint
|
983 |
|
|
{
|
984 |
|
|
get { return (PaintSet)GetValue(OverViewPaintProperty); }
|
985 |
|
|
set
|
986 |
|
|
{
|
987 |
|
|
if (this.OverViewPaint != value)
|
988 |
|
|
{
|
989 |
|
|
SetValue(OverViewPaintProperty, value);
|
990 |
|
|
OnPropertyChanged("OverViewPaint");
|
991 |
|
|
}
|
992 |
|
|
}
|
993 |
|
|
}
|
994 |
|
|
|
995 |
|
|
double IPath.LineSize
|
996 |
|
|
{
|
997 |
|
|
get
|
998 |
|
|
{
|
999 |
|
|
return this.LineSize.Left;
|
1000 |
|
|
}
|
1001 |
|
|
set
|
1002 |
|
|
{
|
1003 |
|
|
this.LineSize = new Thickness(value);
|
1004 |
|
|
OnPropertyChanged("LineSize");
|
1005 |
|
|
}
|
1006 |
|
|
}
|
1007 |
|
|
|
1008 |
|
|
|
1009 |
|
|
public Geometry PathData
|
1010 |
|
|
{
|
1011 |
|
|
get { return (Geometry)GetValue(PathDataProperty); }
|
1012 |
|
|
set { SetValue(PathDataProperty, value);
|
1013 |
|
|
OnPropertyChanged("PathData");
|
1014 |
|
|
}
|
1015 |
|
|
}
|
1016 |
|
|
|
1017 |
|
|
public Geometry PathDataInner
|
1018 |
|
|
{
|
1019 |
|
|
get { return (Geometry)GetValue(PathDataInnerProperty); }
|
1020 |
|
|
set
|
1021 |
|
|
{
|
1022 |
|
|
SetValue(PathDataInnerProperty, value);
|
1023 |
|
|
OnPropertyChanged("PathDataInner");
|
1024 |
|
|
}
|
1025 |
|
|
}
|
1026 |
|
|
|
1027 |
|
|
public double Angle
|
1028 |
|
|
{
|
1029 |
|
|
get { return (double)GetValue(AngleProperty); }
|
1030 |
|
|
set
|
1031 |
|
|
{
|
1032 |
|
|
if (this.Angle != value)
|
1033 |
|
|
{
|
1034 |
|
|
SetValue(AngleProperty, value);
|
1035 |
|
|
|
1036 |
|
|
OnPropertyChanged("Angle");
|
1037 |
|
|
UpdateLayout();
|
1038 |
|
|
}
|
1039 |
|
|
}
|
1040 |
|
|
}
|
1041 |
|
|
|
1042 |
|
|
public bool IsHighLight
|
1043 |
|
|
{
|
1044 |
|
|
get { return (bool)GetValue(IsHighlightProperty); }
|
1045 |
|
|
set
|
1046 |
|
|
{
|
1047 |
|
|
if (this.IsHighLight != value)
|
1048 |
|
|
{
|
1049 |
|
|
SetValue(IsHighlightProperty, value);
|
1050 |
|
|
OnPropertyChanged("IsHighLight");
|
1051 |
|
|
}
|
1052 |
|
|
}
|
1053 |
|
|
}
|
1054 |
|
|
|
1055 |
|
|
public List<Point> PointSet
|
1056 |
|
|
{
|
1057 |
|
|
get { return (List<Point>)GetValue(PointSetProperty); }
|
1058 |
|
|
set { SetValue(PointSetProperty, value);
|
1059 |
|
|
OnPropertyChanged("PointSet");
|
1060 |
|
|
}
|
1061 |
|
|
}
|
1062 |
|
|
|
1063 |
|
|
#endregion Properties
|
1064 |
|
|
|
1065 |
|
|
#region Properties
|
1066 |
|
|
|
1067 |
|
|
|
1068 |
|
|
|
1069 |
|
|
public PathGeometry PathGeometry
|
1070 |
|
|
{
|
1071 |
|
|
get { return (PathGeometry)GetValue(PathGeometryProperty); }
|
1072 |
|
|
set
|
1073 |
|
|
{
|
1074 |
|
|
SetValue(PathGeometryProperty, value);
|
1075 |
|
|
OnPropertyChanged("PathGeometry");
|
1076 |
|
|
}
|
1077 |
|
|
}
|
1078 |
|
|
|
1079 |
|
|
private double _BoxWidth;
|
1080 |
|
|
public double BoxWidth
|
1081 |
|
|
{
|
1082 |
|
|
get
|
1083 |
|
|
{
|
1084 |
|
|
return _BoxWidth;
|
1085 |
|
|
}
|
1086 |
|
|
set
|
1087 |
|
|
{
|
1088 |
|
|
_BoxWidth = value;
|
1089 |
|
|
OnPropertyChanged("BoxWidth");
|
1090 |
|
|
}
|
1091 |
|
|
}
|
1092 |
|
|
|
1093 |
|
|
private double _BoxHeight;
|
1094 |
|
|
public double BoxHeight
|
1095 |
|
|
{
|
1096 |
|
|
get
|
1097 |
|
|
{
|
1098 |
|
|
return _BoxHeight;
|
1099 |
|
|
}
|
1100 |
|
|
set
|
1101 |
|
|
{
|
1102 |
|
|
_BoxHeight = value;
|
1103 |
|
|
OnPropertyChanged("BoxHeight");
|
1104 |
|
|
}
|
1105 |
|
|
}
|
1106 |
|
|
|
1107 |
|
|
#endregion
|
1108 |
|
|
|
1109 |
|
|
#region CallBack Method
|
1110 |
|
|
public static void SetPathGeometryChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1111 |
|
|
{
|
1112 |
|
|
var instance = (TextControl)sender;
|
1113 |
|
|
|
1114 |
|
|
if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
|
1115 |
|
|
{
|
1116 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1117 |
|
|
}
|
1118 |
|
|
}
|
1119 |
|
|
|
1120 |
|
|
|
1121 |
|
|
public static void OnTextBoxVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1122 |
|
|
{
|
1123 |
|
|
var instance = (TextControl)sender;
|
1124 |
|
|
|
1125 |
|
|
if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
|
1126 |
|
|
{
|
1127 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1128 |
|
|
}
|
1129 |
|
|
}
|
1130 |
|
|
|
1131 |
|
|
public static void OnTextBlockVisibilityChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1132 |
|
|
{
|
1133 |
|
|
var instance = (TextControl)sender;
|
1134 |
|
|
|
1135 |
|
|
if (e.OldValue != e.NewValue && instance.Base_TextPath != null)
|
1136 |
|
|
{
|
1137 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1138 |
|
|
}
|
1139 |
|
|
}
|
1140 |
|
|
|
1141 |
|
|
public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1142 |
|
|
{
|
1143 |
|
|
var instance = (TextControl)sender;
|
1144 |
|
|
|
1145 |
|
|
if (e.OldValue != e.NewValue && instance.Base_Border != null)
|
1146 |
|
|
{
|
1147 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1148 |
|
|
|
1149 |
|
|
if (instance.IsSelected)
|
1150 |
|
|
{
|
1151 |
|
|
instance.FontColor = new SolidColorBrush(Colors.Blue);
|
1152 |
|
|
//instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Blue);
|
1153 |
|
|
}
|
1154 |
|
|
else
|
1155 |
|
|
{
|
1156 |
|
|
instance.FontColor = new SolidColorBrush(Colors.Red);
|
1157 |
|
|
//instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Red);
|
1158 |
|
|
//instance.FontColor = new SolidColorBrush(Colors.Transparent);
|
1159 |
|
|
//instance.Base_Border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
1160 |
|
|
}
|
1161 |
|
|
|
1162 |
|
|
}
|
1163 |
|
|
}
|
1164 |
|
|
|
1165 |
|
|
public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1166 |
|
|
{
|
1167 |
|
|
var instance = (TextControl)sender;
|
1168 |
|
|
|
1169 |
|
|
if (e.OldValue != e.NewValue && instance != null)
|
1170 |
|
|
{
|
1171 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1172 |
|
|
|
1173 |
|
|
Canvas.SetLeft(instance, instance.CanvasX);
|
1174 |
|
|
|
1175 |
|
|
Canvas.SetTop(instance, instance.CanvasY);
|
1176 |
|
|
}
|
1177 |
|
|
}
|
1178 |
|
|
|
1179 |
|
|
public static void OnIsEditingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1180 |
|
|
{
|
1181 |
|
|
var instance = (TextControl)sender;
|
1182 |
|
|
|
1183 |
|
|
if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
|
1184 |
|
|
{
|
1185 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1186 |
|
|
|
1187 |
|
|
if (instance.EnableEditing)
|
1188 |
|
|
{
|
1189 |
|
|
if (instance.IsEditing)
|
1190 |
|
|
{
|
1191 |
|
|
instance.EditingMode();
|
1192 |
|
|
}
|
1193 |
|
|
else
|
1194 |
|
|
{
|
1195 |
|
|
instance.UnEditingMode();
|
1196 |
|
|
}
|
1197 |
|
|
}
|
1198 |
|
|
else
|
1199 |
|
|
{
|
1200 |
|
|
instance.UnEditingMode();
|
1201 |
|
|
}
|
1202 |
|
|
}
|
1203 |
|
|
}
|
1204 |
|
|
|
1205 |
|
|
public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1206 |
|
|
{
|
1207 |
|
|
var instance = (TextControl)sender;
|
1208 |
|
|
|
1209 |
|
|
if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
|
1210 |
|
|
{
|
1211 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1212 |
|
|
instance.SetText();
|
1213 |
|
|
}
|
1214 |
|
|
}
|
1215 |
|
|
|
1216 |
|
|
public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1217 |
|
|
{
|
1218 |
|
|
var instance = (TextControl)sender;
|
1219 |
|
|
if (e.OldValue != e.NewValue && instance.Base_TextBlock != null)
|
1220 |
|
|
{
|
1221 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1222 |
|
|
instance.SetText();
|
1223 |
|
|
}
|
1224 |
|
|
}
|
1225 |
|
|
|
1226 |
|
|
public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
1227 |
|
|
{
|
1228 |
|
|
var instance = (TextControl)sender;
|
1229 |
|
|
if (e.OldValue != e.NewValue && instance!= null)
|
1230 |
|
|
{
|
1231 |
|
|
instance.SetValue(e.Property, e.NewValue);
|
1232 |
|
|
instance.SetText();
|
1233 |
|
|
}
|
1234 |
|
|
}
|
1235 |
|
|
|
1236 |
|
|
#endregion CallBack Method
|
1237 |
|
|
|
1238 |
|
|
protected void OnPropertyChanged(string propName)
|
1239 |
|
|
{
|
1240 |
|
|
if (PropertyChanged != null)
|
1241 |
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propName));
|
1242 |
|
|
}
|
1243 |
|
|
}
|
1244 |
|
|
} |