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