개정판 90db87f6
issue #000 처음 TextControl 생성시 TextBox_SizeChanged 이벤트 내에서 Text Property 가 Null 값이면 TextControl을 지우지 않는다.
Change-Id: I50cd553842d760a58f77f615a3b935e1140fbe2e
MarkupToPDF/Controls/Text/TextControl.cs | ||
---|---|---|
63 | 63 |
|
64 | 64 |
public TextControl() |
65 | 65 |
{ |
66 |
this.DefaultStyleKey = typeof(TextControl);
|
|
66 |
this.DefaultStyleKey = typeof(TextControl); |
|
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
static TextControl() |
... | ... | |
72 | 72 |
ResourceDictionary dictionary = new ResourceDictionary(); |
73 | 73 |
dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute); |
74 | 74 |
Application.Current.Resources.MergedDictionaries.Add(dictionary); |
75 |
|
|
75 |
|
|
76 | 76 |
} |
77 |
|
|
78 |
|
|
77 |
|
|
78 |
|
|
79 | 79 |
public override void OnApplyTemplate() |
80 | 80 |
{ |
81 |
base.OnApplyTemplate();
|
|
81 |
base.OnApplyTemplate(); |
|
82 | 82 |
|
83 | 83 |
Base_TextPath = GetTemplateChild(PART_TextPath) as Path; |
84 | 84 |
Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox; |
... | ... | |
86 | 86 |
Base_Grid = GetTemplateChild(PART_Grid) as Grid; |
87 | 87 |
Base_Border = GetTemplateChild(PART_Border) as Border; |
88 | 88 |
Base_Canvas = GetTemplateChild(PART_Canvas) as Canvas; |
89 |
|
|
89 |
|
|
90 | 90 |
this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged); |
91 | 91 |
this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged); |
92 | 92 |
this.Base_TextBox.GotFocus += new RoutedEventHandler(TextControl_GotFocus); |
... | ... | |
102 | 102 |
if (Base_TextBox.Text.Contains("|OR||DZ|")) { |
103 | 103 |
Base_TextBox.Text = this.Text; |
104 | 104 |
} |
105 |
|
|
106 | 105 |
this.Text = Base_TextBox.Text; |
107 | 106 |
DrawingCloud(); |
108 | 107 |
} |
... | ... | |
124 | 123 |
|
125 | 124 |
void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e) |
126 | 125 |
{ |
127 |
|
|
126 |
if (Base_TextBox.Text.Contains("|OR||DZ|")) { |
|
127 |
Base_TextBox.Text = this.Text; |
|
128 |
} |
|
129 |
|
|
130 |
this.Text = Base_TextBox.Text; |
|
128 | 131 |
BoxWidth = e.NewSize.Width; |
129 | 132 |
BoxHeight = e.NewSize.Height; |
130 | 133 |
DrawingCloud(); |
... | ... | |
257 | 260 |
public void DrawingCloud() |
258 | 261 |
{ |
259 | 262 |
this.ApplyTemplate(); |
260 |
|
|
263 |
|
|
261 | 264 |
List<Point> pCloud = new List<Point> |
262 | 265 |
{ |
263 | 266 |
new Point(0, 0), |
... | ... | |
344 | 347 |
int count = pData.Count; |
345 | 348 |
for (int i = 0; i < count; i++) |
346 | 349 |
{ |
347 |
PathFigure pathFigure = GenerateLineWithCloud(pData[i%count], pData[(i + 1)%count], 20, reverse);
|
|
350 |
PathFigure pathFigure = GenerateLineWithCloud(pData[i % count], pData[(i + 1) % count], 20, reverse);
|
|
348 | 351 |
pathFigure.IsClosed = false; |
349 | 352 |
pathFigure.IsFilled = true; |
350 | 353 |
_pathGeometry.Figures.Add(pathFigure); |
... | ... | |
544 | 547 |
} |
545 | 548 |
} |
546 | 549 |
|
547 |
|
|
550 |
|
|
548 | 551 |
|
549 | 552 |
public bool EnableEditing |
550 | 553 |
{ |
... | ... | |
614 | 617 |
public double CenterX |
615 | 618 |
{ |
616 | 619 |
get { return (double)GetValue(CenterXProperty); } |
617 |
set { SetValue(CenterXProperty, value); |
|
618 |
OnPropertyChanged("CenterX"); |
|
619 |
|
|
620 |
set |
|
621 |
{ |
|
622 |
SetValue(CenterXProperty, value); |
|
623 |
OnPropertyChanged("CenterX"); |
|
624 |
|
|
620 | 625 |
} |
621 | 626 |
} |
622 | 627 |
|
623 | 628 |
public double CenterY |
624 | 629 |
{ |
625 | 630 |
get { return (double)GetValue(CenterYProperty); } |
626 |
set { SetValue(CenterYProperty, value); |
|
627 |
OnPropertyChanged("CenterY"); |
|
631 |
set |
|
632 |
{ |
|
633 |
SetValue(CenterYProperty, value); |
|
634 |
OnPropertyChanged("CenterY"); |
|
628 | 635 |
} |
629 | 636 |
} |
630 | 637 |
|
... | ... | |
748 | 755 |
} |
749 | 756 |
} |
750 | 757 |
|
751 |
|
|
758 |
|
|
752 | 759 |
|
753 | 760 |
public TextDecorationCollection UnderLine |
754 | 761 |
{ |
... | ... | |
900 | 907 |
public Geometry PathData |
901 | 908 |
{ |
902 | 909 |
get { return (Geometry)GetValue(PathDataProperty); } |
903 |
set { SetValue(PathDataProperty, value); |
|
904 |
OnPropertyChanged("PathData"); |
|
910 |
set |
|
911 |
{ |
|
912 |
SetValue(PathDataProperty, value); |
|
913 |
OnPropertyChanged("PathData"); |
|
905 | 914 |
} |
906 | 915 |
} |
907 | 916 |
|
... | ... | |
946 | 955 |
public List<Point> PointSet |
947 | 956 |
{ |
948 | 957 |
get { return (List<Point>)GetValue(PointSetProperty); } |
949 |
set { SetValue(PointSetProperty, value); |
|
950 |
OnPropertyChanged("PointSet"); |
|
958 |
set |
|
959 |
{ |
|
960 |
SetValue(PointSetProperty, value); |
|
961 |
OnPropertyChanged("PointSet"); |
|
951 | 962 |
} |
952 | 963 |
} |
953 | 964 |
|
... | ... | |
957 | 968 |
|
958 | 969 |
|
959 | 970 |
|
960 |
public PathGeometry PathGeometry
|
|
971 |
public PathGeometry PathGeometry |
|
961 | 972 |
{ |
962 | 973 |
get { return (PathGeometry)GetValue(PathGeometryProperty); } |
963 | 974 |
set |
... | ... | |
1109 | 1120 |
public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
1110 | 1121 |
{ |
1111 | 1122 |
var instance = (TextControl)sender; |
1112 |
if (e.OldValue != e.NewValue && instance!= null) |
|
1123 |
if (e.OldValue != e.NewValue && instance != null)
|
|
1113 | 1124 |
{ |
1114 | 1125 |
instance.SetValue(e.Property, e.NewValue); |
1115 | 1126 |
//instance.DrawingCloud(); |
1116 | 1127 |
} |
1117 | 1128 |
} |
1118 |
|
|
1129 |
|
|
1119 | 1130 |
#endregion CallBack Method |
1120 | 1131 |
|
1121 | 1132 |
protected void OnPropertyChanged(string propName) |
... | ... | |
1159 | 1170 |
this.SetValue(TextControl.CanvasXProperty, Canvas.GetLeft(this) + dx); |
1160 | 1171 |
this.SetValue(TextControl.CanvasYProperty, Canvas.GetTop(this) + dy); |
1161 | 1172 |
|
1162 |
|
|
1163 | 1173 |
|
1164 |
|
|
1174 |
|
|
1175 |
|
|
1165 | 1176 |
//Canvas.SetLeft(this, Canvas.GetLeft(this) + dx); |
1166 | 1177 |
//Canvas.SetTop(this, Canvas.GetTop(this) + dy); |
1167 | 1178 |
} |
내보내기 Unified diff