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