개정판 0d00f9c8
issue #923: implementing drag textcontrol
Change-Id: I17d1f4ec754ea13646260d1c331d574ad680d47d
MarkupToPDF/Controls/Text/TextControl.cs | ||
---|---|---|
29 | 29 |
private const string PART_TextBox = "PART_TextBox"; |
30 | 30 |
private const string PART_TextPath = "PART_TextPath"; |
31 | 31 |
private const string PART_TextBlock = "PART_TextBlock"; |
32 |
private const string PART_Canvas = "PART_TextControlCanvas"; |
|
32 | 33 |
//private const string PART_TextPrefix = "PART_TextPrefix"; |
33 | 34 |
|
34 | 35 |
public Path Base_TextPath = null; |
35 | 36 |
public Grid Base_Grid = null; |
36 | 37 |
public Border Base_Border = null; |
38 |
public Canvas Base_Canvas = null; |
|
37 | 39 |
//public TextBlock Base_TextPrefixBlock = null; |
38 | 40 |
public TextBlock Base_TextBlock = null; |
39 | 41 |
public TextBox Base_TextBox = null; |
... | ... | |
83 | 85 |
Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock; |
84 | 86 |
Base_Grid = GetTemplateChild(PART_Grid) as Grid; |
85 | 87 |
Base_Border = GetTemplateChild(PART_Border) as Border; |
86 |
|
|
88 |
Base_Canvas = GetTemplateChild(PART_Canvas) as Canvas; |
|
89 |
|
|
87 | 90 |
this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged); |
88 | 91 |
this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged); |
89 | 92 |
this.Base_TextBox.GotFocus += new RoutedEventHandler(TextControl_GotFocus); |
... | ... | |
311 | 314 |
GC.Collect(); |
312 | 315 |
GC.SuppressFinalize(this); |
313 | 316 |
} |
314 |
public void updateControl() |
|
317 |
|
|
318 |
public override void UpdateControl() |
|
315 | 319 |
{ |
316 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
|
317 |
this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
|
320 |
if (this.PointSet.Count > 1) |
|
321 |
{ |
|
322 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
|
323 |
this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
|
324 |
} |
|
318 | 325 |
} |
319 | 326 |
|
320 | 327 |
#region Drawing Cloud Method |
... | ... | |
1062 | 1069 |
instance.SetValue(e.Property, e.NewValue); |
1063 | 1070 |
|
1064 | 1071 |
Canvas.SetLeft(instance, instance.CanvasX); |
1065 |
|
|
1066 | 1072 |
Canvas.SetTop(instance, instance.CanvasY); |
1067 | 1073 |
} |
1068 | 1074 |
} |
... | ... | |
1146 | 1152 |
} |
1147 | 1153 |
|
1148 | 1154 |
/// <summary> |
1149 |
/// translate TextControl by given dx, dy
|
|
1155 |
/// translate control along given dx,dy
|
|
1150 | 1156 |
/// </summary> |
1151 | 1157 |
/// <param name="dx"></param> |
1152 | 1158 |
/// <param name="dy"></param> |
1153 |
public override void Move(double dx, double dy)
|
|
1159 |
public override void OnTranslate(double dx, double dy)
|
|
1154 | 1160 |
{ |
1155 |
this.SetValue(TextControl.CanvasXProperty, Canvas.GetLeft(this) + dx); |
|
1156 |
this.SetValue(TextControl.CanvasYProperty, Canvas.GetTop(this) + dy); |
|
1161 |
//this.CanvasX = Canvas.GetLeft(this) + dx; |
|
1162 |
//this.CanvasY = Canvas.GetTop(this) + dy; |
|
1163 |
|
|
1164 |
//this.SetValue(TextControl.CanvasXProperty, Canvas.GetLeft(this) + dx); |
|
1165 |
//this.SetValue(TextControl.CanvasYProperty, Canvas.GetTop(this) + dy); |
|
1157 | 1166 |
this.StartPoint = new Point(this.StartPoint.X + dx, this.StartPoint.Y + dy); |
1158 | 1167 |
this.EndPoint = new Point(this.EndPoint.X + dx, this.EndPoint.Y + dy); |
1168 |
|
|
1169 |
Canvas.SetLeft(this, Canvas.GetLeft(this) + dx); |
|
1170 |
Canvas.SetTop(this, Canvas.GetTop(this) + dy); |
|
1159 | 1171 |
} |
1160 | 1172 |
|
1161 | 1173 |
/// <summary> |
내보내기 Unified diff