프로젝트

일반

사용자정보

개정판 da7ab6ad

IDda7ab6adc39d8b93264d81771c5e1ad6108c1636
상위 f0dba314
하위 20bb0e09

김태성이(가) 5년 이상 전에 추가함

issue #0110 ArrowTextControl angle 문제 수정

Change-Id: I5a99bab25b7ee7ce529bf8f611117e425bfb1191

차이점 보기:

MarkupTest/MainWindow.xaml
8 8
         xmlns:Text="clr-namespace:MarkupToPDF.Controls.Text;assembly=MarkupToPDF"
9 9
        Title="MainWindow" Height="450" Width="800">
10 10
    <Canvas>
11
        <Text:ArrowTextControl Width="213" Height="160" Canvas.Top="10">
11
        <Text:ArrowTextControl Width="214" Height="160" Canvas.Top="-2" Canvas.Left="44">
12 12
            <Text:ArrowTextControl.Style>
13 13
                <Style TargetType="{x:Type Text:ArrowTextControl}">
14 14
                    <Setter Property="Template">
......
31 31
                                      Fill="{TemplateBinding BackInnerColor }" Canvas.ZIndex="1"
32 32
                                      Data="m1.99999,-0.54687c0,0 3.10617,1.97499 21.28572,15.31915c30.03604,22.04707 66.51786,53.61702 101.10715,81.70213l21.28572,17.87234l5.32143,5.10638"
33 33
                                      RenderTransformOrigin="0,0"/>
34
                                 <TextBox x:Name="PART_ArrowTextBox"  
34
                                    <TextBox x:Name="PART_ArrowTextBox"  
35 35
                                         Margin="0.5" Canvas.ZIndex="4"
36
                                          Text="test"
36 37
                                         Background="{TemplateBinding TextBoxBackground}"
37
                                         BorderThickness="{TemplateBinding BorderSize}" 
38
                                         BorderBrush="{TemplateBinding StrokeColor}"
39
                                         FontSize="{TemplateBinding TextSize}" 
40
                                         FontFamily="{TemplateBinding TextFamily}"
41
                                         FontStyle="{TemplateBinding TextStyle}"
42
								         FontWeight="{TemplateBinding TextWeight}"
43
                                         TextDecorations="{TemplateBinding UnderLine}"
38
                                         BorderThickness="1" 
39
                                         BorderBrush="Green"
40
                                         FontSize="20" 
44 41
                                         AcceptsReturn="True" 
45
                                         Foreground="{TemplateBinding StrokeColor}" 
42
                                         Foreground="Red" 
46 43
                                         HorizontalAlignment="Stretch"
47
                                         TextWrapping="Wrap" 
48
                                         Text="test" Width="100"
44
                                         TextWrapping="Wrap" Width="100"
49 45
                                         RenderTransformOrigin="0.5,0.5">
50 46
                                        <TextBox.RenderTransform>
51 47
                                            <RotateTransform Angle="0"
52
                                                        CenterX="{Binding CenterX, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
53
                                                        CenterY="{Binding CenterY, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
48
                                                        CenterX="0"
49
                                                        CenterY="0">
54 50
                                            </RotateTransform>
55
                                            <!--<RotateTransform Angle="{Binding PageAngle, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
56
                                                        CenterX="{Binding CenterX, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
57
                                                        CenterY="{Binding CenterY, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
58
                                </RotateTransform>-->
59 51
                                        </TextBox.RenderTransform>
60 52
                                    </TextBox>
61 53

  
......
72 64
                                            RenderTransformOrigin="0.5,0.5">
73 65
                                            <Border.RenderTransform>
74 66
                                                <RotateTransform Angle="0"
75
                                                                CenterX="{Binding CenterX, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
76
                                                                CenterY="{Binding CenterY, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
67
                                                                CenterX="0"
68
                                                                CenterY="0">
77 69
                                                </RotateTransform>
78
                                                <!--<RotateTransform Angle="{Binding CommentAngle, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
79
                                                                CenterX="{Binding CenterX, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
80
                                                                CenterY="{Binding CenterY, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
81
                                    </RotateTransform>-->
82 70
                                            </Border.RenderTransform>
83
                                            <Border.Triggers>
84
                                                <EventTrigger RoutedEvent="Border.Loaded">
85
                                                    <BeginStoryboard>
86
                                                        <Storyboard  x:Name="CaretStoryBoard" 
87
                                                                     RepeatBehavior="Forever">
88
                                                            <ColorAnimationUsingKeyFrames 
89
                                                                    Storyboard.TargetProperty="Background.Color"
90
                                                                    Duration="0:0:0:1"
91
                                                                    FillBehavior="HoldEnd">
92
                                                                <ColorAnimationUsingKeyFrames.KeyFrames >
93
                                                                    <DiscreteColorKeyFrame KeyTime="0:0:0.750" Value="Transparent" />
94
                                                                    <DiscreteColorKeyFrame KeyTime="0:0:0.000" Value="Black"/>
95
                                                                </ColorAnimationUsingKeyFrames.KeyFrames>
96
                                                            </ColorAnimationUsingKeyFrames>
97
                                                        </Storyboard>
98
                                                    </BeginStoryboard>
99
                                                </EventTrigger>
100
                                            </Border.Triggers>
101 71
                                        </Border>
102 72
                                    </Canvas>
103 73

  
......
109 79
                </Style>
110 80
            </Text:ArrowTextControl.Style>
111 81
        </Text:ArrowTextControl>
82

  
83
        <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
84
            <Path x:Name="PART_ArrowPath"  Canvas.ZIndex="0"
85
                                  Stroke="Red"
86
						          StrokeThickness="1" 
87
                                  Data=""
88
                                  Fill="Red"/>
89
            <Path x:Name="PART_ArrowSubPath"  Canvas.ZIndex="2"
90
                                      Stroke="Red"
91
						              StrokeThickness="1"  
92
                                      Fill="Firebrick"
93
                                      Data=""
94
                                      RenderTransformOrigin="0,0"/>
95
            <Path 
96
                                      Stroke="Transparent"
97
                                      Fill="Red" Canvas.ZIndex="1"
98
                                      Data="m1.99999,-0.54687c0,0 3.10617,1.97499 21.28572,15.31915c30.03604,22.04707 66.51786,53.61702 101.10715,81.70213l21.28572,17.87234l5.32143,5.10638"
99
                                      RenderTransformOrigin="0,0"/>
100
            <TextBox x:Name="PART_ArrowTextBox" Canvas.ZIndex="4"
101
                                          Text="test"
102
                                         Background="MediumSpringGreen"
103
                                         BorderThickness="1" 
104
                                         BorderBrush="Green"
105
                                         FontSize="20" 
106
                                         AcceptsReturn="True" 
107
                                         Foreground="Red" 
108
                                         HorizontalAlignment="Stretch"
109
                                         TextWrapping="Wrap" Width="100"
110
                                         RenderTransformOrigin="0.5,0.5" Canvas.Left="150" Canvas.Top="116">
111
                <TextBox.RenderTransform>
112
                    <RotateTransform Angle="0"
113
                                                        CenterX="0"
114
                                                        CenterY="0">
115
                    </RotateTransform>
116
                </TextBox.RenderTransform>
117
            </TextBox>
118

  
119
            <Canvas Canvas.ZIndex="5">
120
                <Border x:Name="Caret" 
121
                                            Visibility="Visible"
122
                                            Canvas.Left="0" 
123
                                            Canvas.Top="0" 
124
                                            Width="3" 
125
                                            Height="33" 
126
                                            Background="Red"
127
                                           
128
                                            RenderTransformOrigin="0.5,0.5">
129
                    <Border.RenderTransform>
130
                        <RotateTransform Angle="0"
131
                                                                CenterX="0"
132
                                                                CenterY="0">
133
                        </RotateTransform>
134
                    </Border.RenderTransform>
135
                </Border>
136
            </Canvas>
137
        </Canvas>
112 138
    </Canvas>
113 139
</Window>
MarkupToPDF/Controls/Text/ArrowTextControl.cs
204 204
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
205 205
        {
206 206
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
207
            MoveCustomCaret();
207 208
            this.IsEditingMode = true;
208 209
        }
209 210

  
......
983 984
            connectorSMGeometry.EndPoint = this.MidPoint;
984 985
            connectorMEGeometry.StartPoint = this.MidPoint; //핵심
985 986

  
987
            /// 텍스트박스의 좌표 설정
986 988
            Canvas.SetLeft(Base_TextBox, this.EndPoint.X);
987 989
            Canvas.SetTop(Base_TextBox, this.EndPoint.Y);
988
             
990
            System.Diagnostics.Debug.WriteLine($"TextBox Set {this.EndPoint.X},{this.EndPoint.Y}");
991
            
992

  
989 993
            List<Point> ps = new List<Point>();
990 994
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox))); //상단
991 995
            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxWidth / 2, Canvas.GetTop(Base_TextBox) + this.BoxHeight)); // 하단
......
1173 1177
                            ps.Add(new Point(Canvas.GetLeft(Base_TextBox) - this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 
1174 1178
                        }
1175 1179
                        break;
1180
                    //case "180":
1181
                    //    {
1182
                    //        ps.Clear();
1183

  
1184
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox))); //위 왼쪽
1185
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); // 위 중간
1186
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox), Canvas.GetTop(Base_TextBox) + this.BoxWidth)); // 위 오른쪽
1187

  
1188
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox))); //왼쪽 중간
1189
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox))); //왼쪽 하단
1190

  
1191
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth / 2)); //중간 하단
1192
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 하단
1193

  
1194
                    //        ps.Add(new Point(Canvas.GetLeft(Base_TextBox) + this.BoxHeight / 2, Canvas.GetTop(Base_TextBox) + this.BoxWidth)); //오른쪽 중간 
1195
                    //    }
1196
                    //    break;
1176 1197
                    default:
1177 1198
                        break;
1178 1199
                }
......
1338 1359

  
1339 1360
            System.Diagnostics.Debug.WriteLine($"base TextBox center X : {this.CenterX} Y : {this.CenterY} ");
1340 1361

  
1341
            BaseTextbox_Caret.RenderTransform = new RotateTransform
1342
            {
1343
                Angle = this.VisualPageAngle,
1344
                CenterX = this.CenterX,
1345
                CenterY = this.CenterY,
1346
            };
1362
            
1347 1363

  
1348 1364
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1349 1365
            {
......
1352 1368
                CenterY = this.EndPoint.Y,
1353 1369
            };
1354 1370

  
1355
            MoveCustomCaret();
1371
            if (BaseTextbox_Caret.Visibility == Visibility.Visible)
1372
            {
1373
                BaseTextbox_Caret.RenderTransform = new RotateTransform
1374
                {
1375
                    Angle = this.VisualPageAngle,
1376
                    CenterX = this.CenterX,
1377
                    CenterY = this.CenterY,
1378
                };
1379

  
1380
                MoveCustomCaret();
1381
            }
1356 1382
        }
1357 1383

  
1358 1384
        private void DrawingCloud()
......
1413 1439
            {
1414 1440
                this.Base_TextBox.BorderBrush = Brushes.Transparent;
1415 1441
            }
1442

  
1416 1443
            if (Math.Abs(this.PageAngle).ToString() == "90")
1417 1444
            {
1418 1445
                List<Point> pCloud = new List<Point>()

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)