개정판 f513c215
issue #923: add CreateCommand and change thumb's opacity when mouse is enter or leave
Change-Id: I1e4b2ac57ca876e4681b14f02c1567abb265391e
MarkupToPDF/Controls/Text/ArrowTextControl.cs | ||
---|---|---|
38 | 38 |
LineGeometry connectorSMGeometry = new LineGeometry(); |
39 | 39 |
LineGeometry connectorMEGeometry = new LineGeometry(); |
40 | 40 |
|
41 |
//안쓰고 있음 |
|
42 |
//LineGeometry connectorMCEGeometry = new LineGeometry(); |
|
43 |
|
|
44 | 41 |
public enum ArrowTextStyleSet { Normal, Cloud, Rect }; |
45 | 42 |
|
46 | 43 |
#endregion |
... | ... | |
64 | 61 |
Base_ArrowPath = GetTemplateChild(PART_ArrowPath) as Path; |
65 | 62 |
Base_ArrowSubPath = GetTemplateChild(PART_ArrowSubPath) as Path; |
66 | 63 |
Base_TextBox = GetTemplateChild(PART_TextBox) as TextBox; |
67 |
//Base_TextBlock = GetTemplateChild(PART_TextBlock) as TextBlock; |
|
68 |
|
|
69 |
//CustomText custom = new CustomText(); |
|
70 |
//Base_TextBox.Template = custom.T_Box.Template; |
|
71 |
//Base_TextBox.Style = custom.T_Box.Style; |
|
72 |
////Base_TextBox.Template = custom.T_Box.Template.Triggers; |
|
73 |
////TextBoxBackground = Brushes.Red; |
|
74 |
////Base_TextBox.Opacity = 0.5; |
|
75 | 64 |
|
76 | 65 |
Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged); |
77 | 66 |
Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus); |
78 | 67 |
Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus); |
79 | 68 |
|
80 |
//Base_TextBlock.SizeChanged += Base_TextBlock_SizeChanged; |
|
81 | 69 |
SetArrowTextPath(); |
82 |
//Base_ArrowPath.Focus(); |
|
83 |
//Base_TextBox.Focus(); |
|
84 | 70 |
Base_TextBox.IsTabStop = true; |
85 |
//Base_TextBox.IsHitTestVisible = false; |
|
86 |
|
|
87 | 71 |
} |
88 | 72 |
|
89 | 73 |
void Base_TextBox_LostFocus(object sender, RoutedEventArgs e) |
... | ... | |
114 | 98 |
SetArrowTextPath(); |
115 | 99 |
} |
116 | 100 |
|
117 |
//void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e) |
|
118 |
//{ |
|
119 |
// Base_TextBlock.Text = Base_TextBox.Text; |
|
120 |
|
|
121 |
// BoxWidth = e.NewSize.Width; |
|
122 |
// BoxHeight = e.NewSize.Height; |
|
123 |
|
|
124 |
// this.ApplyTemplate(); |
|
125 |
// SetArrowTextPath(); |
|
126 |
//} |
|
127 |
|
|
128 | 101 |
#region Properties |
129 | 102 |
private bool _IsEditingMode; |
130 | 103 |
public bool IsEditingMode |
... | ... | |
884 | 857 |
Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4); |
885 | 858 |
} |
886 | 859 |
|
887 |
|
|
888 |
#region 주석 |
|
889 |
|
|
890 |
// public void SetArrowTextPath() |
|
891 |
// { |
|
892 |
// instanceGroup.Children.Clear(); |
|
893 |
|
|
894 |
// instanceSubGroup = new PathGeometry(); |
|
895 |
// connectorSMGeometry.StartPoint = this.StartPoint; |
|
896 |
// connectorSMGeometry.EndPoint = this.MidPoint; |
|
897 |
// connectorMEGeometry.StartPoint = this.MidPoint; //핵심 |
|
898 |
|
|
899 |
// //Canvas.SetLeft(Base_TextBox, this.EndPoint.X - BoxWidth / 2); |
|
900 |
// //Canvas.SetTop(Base_TextBox, this.EndPoint.Y - BoxHeight / 2); |
|
901 |
|
|
902 |
// Canvas.SetLeft(Base_TextBox, this.EndPoint.X); |
|
903 |
// Canvas.SetTop(Base_TextBox, this.EndPoint.Y); |
|
904 |
|
|
905 |
|
|
906 |
|
|
907 |
// List<Point> ps = new List<Point>(); |
|
908 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단 |
|
909 |
|
|
910 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단 |
|
911 |
|
|
912 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //좌단 |
|
913 |
|
|
914 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight / 2)); //우단 |
|
915 |
|
|
916 |
// //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox))); |
|
917 |
// //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); |
|
918 |
// //ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxHeight)); |
|
919 |
// //ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); |
|
920 |
|
|
921 |
// if (isTrans) |
|
922 |
// { |
|
923 |
// switch (Math.Abs(this.Angle).ToString()) |
|
924 |
// { |
|
925 |
// case "90": |
|
926 |
// { |
|
927 |
// ps.Clear(); |
|
928 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽 |
|
929 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간 |
|
930 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽 |
|
931 |
|
|
932 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간 |
|
933 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단 |
|
934 |
|
|
935 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단 |
|
936 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단 |
|
937 |
|
|
938 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간 |
|
939 |
// } |
|
940 |
// break; |
|
941 |
// case "270": |
|
942 |
// { |
|
943 |
// ps.Clear(); |
|
944 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽 |
|
945 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간 |
|
946 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽 |
|
947 |
|
|
948 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간 |
|
949 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단 |
|
950 |
|
|
951 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단 |
|
952 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단 |
|
953 |
|
|
954 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 |
|
955 |
// } |
|
956 |
// break; |
|
957 |
// default: |
|
958 |
// break; |
|
959 |
// } |
|
960 |
// var endP = MathSet.getNearPoint(ps, this.MidPoint); |
|
961 |
|
|
962 |
// connectorMEGeometry.EndPoint = endP; |
|
963 |
// instanceGroup.Children.Add(SingleAllow(this.MidPoint, this.StartPoint, this.LineSize)); |
|
964 |
// } |
|
965 |
// else |
|
966 |
// { |
|
967 |
// switch (Math.Abs(this.Angle).ToString()) |
|
968 |
// { |
|
969 |
// case "90": |
|
970 |
// { |
|
971 |
// ps.Clear(); |
|
972 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽 |
|
973 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); // 위 중간 |
|
974 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) - this.BoxWidth)); // 위 오른쪽 |
|
975 |
|
|
976 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간 |
|
977 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단 |
|
978 |
|
|
979 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth / 2)); //중간 하단 |
|
980 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 하단 |
|
981 |
|
|
982 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) - this.BoxWidth)); //오른쪽 중간 |
|
983 |
// } |
|
984 |
// break; |
|
985 |
// case "270": |
|
986 |
// { |
|
987 |
// ps.Clear(); |
|
988 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽 |
|
989 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간 |
|
990 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽 |
|
991 |
|
|
992 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간 |
|
993 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단 |
|
994 |
|
|
995 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단 |
|
996 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단 |
|
997 |
|
|
998 |
// ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 |
|
999 |
// } |
|
1000 |
// break; |
|
1001 |
// default: |
|
1002 |
// break; |
|
1003 |
// } |
|
1004 |
|
|
1005 |
// var endP = MathSet.getNearPoint(ps, this.MidPoint); |
|
1006 |
// connectorMEGeometry.EndPoint = endP; //최상단 |
|
1007 |
|
|
1008 |
// #region 보정치 |
|
1009 |
|
|
1010 |
|
|
1011 |
// //enP는 그 점 |
|
1012 |
|
|
1013 |
// //Point testP = new Point(endP.X-100,endP.Y); |
|
1014 |
// Point testP = endP; |
|
1015 |
|
|
1016 |
// if (isFixed) |
|
1017 |
// { |
|
1018 |
// if (ps[0] == endP) //상단 |
|
1019 |
// { |
|
1020 |
// testP = new Point(endP.X, endP.Y - 50); |
|
1021 |
// System.Diagnostics.Debug.WriteLine("상단"); |
|
1022 |
// } |
|
1023 |
// else if (ps[1] == endP) //하단 |
|
1024 |
// { |
|
1025 |
// testP = new Point(endP.X, endP.Y + 50); |
|
1026 |
// System.Diagnostics.Debug.WriteLine("하단"); |
|
1027 |
// } |
|
1028 |
// else if (ps[2] == endP) //좌단 |
|
1029 |
// { |
|
1030 |
// testP = new Point(endP.X - 50, endP.Y); |
|
1031 |
// System.Diagnostics.Debug.WriteLine("좌단"); |
|
1032 |
// } |
|
1033 |
// else if (ps[3] == endP) //우단 |
|
1034 |
// { |
|
1035 |
// testP = new Point(endP.X + 50, endP.Y); |
|
1036 |
// System.Diagnostics.Debug.WriteLine("우단"); |
|
1037 |
// } |
|
1038 |
// } |
|
1039 |
// connectorSMGeometry.EndPoint = testP; |
|
1040 |
// connectorMEGeometry.StartPoint = testP; |
|
1041 |
|
|
1042 |
// //connectorSMGeometry.EndPoint = endP; |
|
1043 |
// //connectorMEGeometry.StartPoint = endP; |
|
1044 |
// instanceGroup.Children.Add(SingleAllow(testP, this.StartPoint, this.LineSize)); |
|
1045 |
// #endregion |
|
1046 |
// } |
|
1047 |
|
|
1048 |
// switch (this.ArrowTextStyle) |
|
1049 |
// { |
|
1050 |
// case ArrowTextStyleSet.Normal: |
|
1051 |
// this.BorderSize = new Thickness(0); |
|
1052 |
// break; |
|
1053 |
// case ArrowTextStyleSet.Cloud: |
|
1054 |
// this.BorderSize = new Thickness(0); |
|
1055 |
// DrawingCloud(); |
|
1056 |
// break; |
|
1057 |
// default: |
|
1058 |
// this.BorderSize = new Thickness(3); |
|
1059 |
// break; |
|
1060 |
// } |
|
1061 |
|
|
1062 |
// if (isHighLight) |
|
1063 |
// { |
|
1064 |
// Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B)); |
|
1065 |
// Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.Yellow.R, Colors.Yellow.G, Colors.Yellow.B)); |
|
1066 |
|
|
1067 |
// } |
|
1068 |
// else |
|
1069 |
// { |
|
1070 |
// //Base_ArrowSubPath.Fill = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
|
1071 |
// //Base_TextBox.Background = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
|
1072 |
// } |
|
1073 |
|
|
1074 |
// instanceGroup.Children.Add(connectorSMGeometry); |
|
1075 |
// instanceGroup.Children.Add(connectorMEGeometry); |
|
1076 |
|
|
1077 |
// this.Base_ArrowPath.Stroke = this.StrokeColor; |
|
1078 |
// this.PathData = instanceGroup; |
|
1079 |
|
|
1080 |
// Base_ArrowSubPath.Data = instanceSubGroup; |
|
1081 |
|
|
1082 |
// var tempAngle = Math.Abs(this.Angle); |
|
1083 |
|
|
1084 |
// if (tempAngle == Convert.ToDouble(90) || tempAngle == Convert.ToDouble(270)) |
|
1085 |
// { |
|
1086 |
// this.RenderTransformOrigin = new Point(0.5, 0.5); |
|
1087 |
// this.Base_ArrowPath.RenderTransformOrigin = new Point(0, 0); |
|
1088 |
// this.Base_ArrowSubPath.RenderTransformOrigin = new Point(0, 0); |
|
1089 |
|
|
1090 |
// Base_TextBox.RenderTransformOrigin = new Point(0, 0); |
|
1091 |
// } |
|
1092 |
|
|
1093 |
// Base_ArrowSubPath.RenderTransform = new RotateTransform |
|
1094 |
// { |
|
1095 |
// Angle = this.Angle, |
|
1096 |
// CenterX = this.EndPoint.X, |
|
1097 |
// CenterY = this.EndPoint.Y, |
|
1098 |
// }; |
|
1099 |
// } |
|
1100 |
|
|
1101 |
// public void updateControl() |
|
1102 |
// { |
|
1103 |
// this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
|
1104 |
// this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
|
1105 |
// this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y); |
|
1106 |
// //isTrans = true; |
|
1107 |
// } |
|
1108 |
|
|
1109 |
// private void DrawingCloud() |
|
1110 |
// { |
|
1111 |
// List<Point> pCloud = new List<Point>() |
|
1112 |
// { |
|
1113 |
//#if SILVERLIGHT |
|
1114 |
// new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위 |
|
1115 |
// new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래 |
|
1116 |
// new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight), |
|
1117 |
// new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)), |
|
1118 |
// new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위 |
|
1119 |
//#else |
|
1120 |
// new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위 |
|
1121 |
// new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight), //왼쪽 아래 |
|
1122 |
// new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth, Canvas.GetTop(Base_TextBox) + BoxHeight), |
|
1123 |
// new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth, Canvas.GetTop(Base_TextBox)), |
|
1124 |
// new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위 |
|
1125 |
|
|
1126 |
// //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위 |
|
1127 |
// //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)+ BoxHeight-4), //왼쪽 아래 |
|
1128 |
// //new Point(Canvas.GetLeft(Base_TextBox)+ BoxWidth-1, Canvas.GetTop(Base_TextBox) + BoxHeight-4), |
|
1129 |
// //new Point(Canvas.GetLeft(Base_TextBox) + BoxWidth-1, Canvas.GetTop(Base_TextBox)), |
|
1130 |
// //new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox)), //위 |
|
1131 |
//#endif |
|
1132 |
// }; |
|
1133 |
// //instanceGroup.Children.Add(Generate(pCloud)); |
|
1134 |
// instanceSubGroup = (Generate(pCloud)); |
|
1135 |
|
|
1136 |
// } |
|
1137 |
|
|
1138 |
#endregion |
|
1139 |
|
|
1140 | 860 |
private void SetArrowTextPath() |
1141 | 861 |
{ |
1142 | 862 |
instanceGroup.Children.Clear(); |
... | ... | |
1176 | 896 |
break; |
1177 | 897 |
case "270": |
1178 | 898 |
{ |
1179 |
|
|
1180 | 899 |
ps.Clear(); |
1181 | 900 |
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽 |
1182 | 901 |
ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간 |
... | ... | |
1610 | 1329 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
1611 | 1330 |
this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
1612 | 1331 |
this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y); |
1613 |
//isTrans = true; |
|
1614 | 1332 |
} |
1615 | 1333 |
|
1616 |
public void ApplyOverViewData() |
|
1334 |
public override void ApplyOverViewData()
|
|
1617 | 1335 |
{ |
1618 | 1336 |
this.OverViewPathData = this.PathData; |
1619 | 1337 |
if (ArrowText == "") |
내보내기 Unified diff