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