프로젝트

일반

사용자정보

개정판 3c71b3a5

ID3c71b3a50a242bae59271faa25fb4515049540b6
상위 12caf251
하위 b7813553, 997071b8

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

issue #000: merged master

Change-Id: Id7e766c44e158848f168c86ae220da1700fa36ad

차이점 보기:

MarkupToPDF/Controls/Text/TextControl.cs
96 96
            this.Base_TextBox.ApplyTemplate();
97 97
            MoveCustomCaret();
98 98

  
99
            this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);
100
            this.Base_TextBlock.SizeChanged += new SizeChangedEventHandler(Base_TextBlock_SizeChanged);
101
            this.Base_TextBox.GotFocus += new RoutedEventHandler(TextControl_GotFocus);
102
            this.Base_TextBox.LostFocus += new RoutedEventHandler(TextControl_LostFocus);
103
            this.Base_TextBox.TextChanged += new TextChangedEventHandler(Base_TextBox_TextChanged);
99
            this.Base_TextBox.SizeChanged += new SizeChangedEventHandler(Base_TextBox_SizeChanged);            
100
            this.Base_TextBox.GotFocus += new RoutedEventHandler(Base_TextBox_GotFocus);
101
            this.Base_TextBox.LostFocus += new RoutedEventHandler(Base_TextBox_LostFocus);            
104 102
            this.Base_TextBox.SelectionChanged += (sender, e) => MoveCustomCaret();
105 103
            
106 104
            DrawingCloud();
......
127 125
            }
128 126
        }
129 127

  
130
        private void Base_TextBox_TextChanged(object sender, TextChangedEventArgs e)
131
        {
132
            if (Base_TextBox.Text.Contains("|OR||DZ|")) {
133
                Base_TextBox.Text = this.Text;
134
            }
135
           
136
            
137
            this.Text = Base_TextBox.Text;
138
           
139

  
140
            DrawingCloud();
141
        }
128
        
142 129

  
143 130
        public override void ApplyOverViewData()
144 131
        {
......
146 133
            this.OverViewText = this.Text;
147 134
            this.OverViewPaint = this.Paint;
148 135

  
149
        }
150

  
151
        void Base_TextBlock_SizeChanged(object sender, SizeChangedEventArgs e)
152
        {
153
            BoxWidth = e.NewSize.Width;
154
            BoxHeight = e.NewSize.Height;
155
           
156
            DrawingCloud();
157
        }
136
        }        
158 137

  
159 138
        void Base_TextBox_SizeChanged(object sender, SizeChangedEventArgs e)
160
        {
161
            if (Base_TextBox.Text.Contains("|OR||DZ|")) {
162
                Base_TextBox.Text = this.Text;
163
            }
139
        {          
140
            if(IsEditingMode)
141
            {
142
                if (Base_TextBox.Text.Contains("|OR||DZ|"))
143
                {
144
                    Base_TextBox.Text = this.Text;
145
                }
164 146

  
165
            this.Text = Base_TextBox.Text;
166
            BoxWidth = e.NewSize.Width;
167
            BoxHeight = e.NewSize.Height;
168
            DrawingCloud();
147
                this.Text = Base_TextBox.Text;
148
                BoxWidth = e.NewSize.Width;
149
                BoxHeight = e.NewSize.Height;
150
                DrawingCloud();
151
            }            
169 152
        }
170 153

  
171
        void TextControl_GotFocus(object sender, RoutedEventArgs e)
154
        void Base_TextBox_GotFocus(object sender, RoutedEventArgs e)
172 155
        {
173
            if (EnableEditing)
174
            {
175
                EditingMode();
176
                
177
            }
178
            else
179
            {
180
                
181
                UnEditingMode();
182
            }
156
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
157
            this.IsEditingMode = true;
183 158
        }
184 159

  
185
        void TextControl_LostFocus(object sender, RoutedEventArgs e)
160
        void Base_TextBox_LostFocus(object sender, RoutedEventArgs e)
186 161
        {
187
            UnEditingMode();
162
            this.Text = Base_TextBox.Text;
163
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
164
            this.IsEditingMode = false;
188 165
            ApplyOverViewData();
189 166
        }
190 167

  
......
216 193
        //       new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4, Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
217 194
        //    IsEditing = false;
218 195
        //}
219

  
220 196
        public void EditingMode()
221
        {
222
            //this.Base_TextBox.Focus();
223
            //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString());
224
            
225

  
197
        {            
226 198
            TextBoxVisibility = Visibility.Visible;
227
            //Base_TextBox.Visibility = System.Windows.Visibility.Visible;
228

  
229 199
            TextBlockVisibility = Visibility.Collapsed;
230
            //Base_TextBlock.Visibility = System.Windows.Visibility.Collapsed;
231
            this.BaseTextbox_Caret.Visibility = Visibility.Visible; 
232
            
233
            //this.Base_TextBox.BorderThickness = new Thickness(1);
200
            this.BaseTextbox_Caret.Visibility = Visibility.Visible;
234 201

  
235 202
            if (UnderLine != null)
236 203
                Base_TextBlock.TextDecorations = UnderLine;
237 204

  
238
            if (this.Text != null) {
239
                this.Base_TextBox.Text = this.Text;
240
                MoveCustomCaret();
241
                //this.Base_TextBox.CaretIndex = this.Base_TextBox.Text.Length;
242
                //this.Base_TextBox.Select(Base_TextBox.Text.Length, 0);
243
            }
244
            
245
            //            Base_TextBox.Margin =
246
            //new Thickness(Base_TextBlock.Margin.Left + -2, Base_TextBlock.Margin.Top + 0,
247
            //Base_TextBlock.Margin.Right + 0, Base_TextBlock.Margin.Bottom + -2);
248 205
        }
249 206

  
250 207
        public void UnEditingMode()
251
        {
252
            if (EnableEditing)
253
                this.Text = Base_TextBox.Text;
254

  
255
            this.Base_TextBox.Select(Base_TextBox.Text.Length, 0);
256

  
257
            TextBoxVisibility = Visibility.Collapsed;
258
            //Base_TextBox.Visibility = System.Windows.Visibility.Collapsed;
259

  
260
            TextBlockVisibility = Visibility.Visible;
261
            //Base_TextBlock.Visibility = System.Windows.Visibility.Visible;
262

  
208
        {            
209
            TextBoxVisibility = Visibility.Collapsed;         
210
            TextBlockVisibility = Visibility.Visible; 
263 211
            this.BaseTextbox_Caret.Visibility = Visibility.Collapsed;
264 212

  
265 213
            if (UnderLine != null)
266 214
                Base_TextBlock.TextDecorations = UnderLine;
267 215

  
268
            //Base_TextBox.Focusable = false;
269

  
270
            //Base_TextBlock.Margin =
271
            //     new Thickness(Base_TextBox.Margin.Left + 4, Base_TextBox.Margin.Top + 4,
272
            //         Base_TextBox.Margin.Right + 4, Base_TextBox.Margin.Bottom + 4);
273

  
274
            //       Base_TextBlock.Margin =
275
            //new Thickness(Base_TextBox.Margin.Left + 2, Base_TextBox.Margin.Top + 2,
276
            //    Base_TextBox.Margin.Right + 2, Base_TextBox.Margin.Bottom + 2);
277

  
278
            //            Base_TextBlock.Margin =
279
            //new Thickness(Base_TextBox.Margin.Left + 5, Base_TextBox.Margin.Top + 0,
280
            //Base_TextBox.Margin.Right + 0, Base_TextBox.Margin.Bottom + 2);
216
            
281 217
        }
282

  
283 218
        public void SetText()
284 219
        {
285
            this.ApplyTemplate();
286

  
287 220
            if (IsHighLight)
288 221
            {
289 222
                this.BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6),
......
307 240

  
308 241
        public void DrawingCloud()
309 242
        {
310
            this.ApplyTemplate();
311

  
312 243
            List<Point> pCloud = new List<Point>
313 244
            {
314 245
                new Point(0, 0),
......
1014 945

  
1015 946
        #region Properties
1016 947

  
1017

  
948
        private bool _IsEditingMode;
949
        public bool IsEditingMode
950
        {
951
            get
952
            {
953
                return _IsEditingMode;
954
            }
955
            set
956
            {
957
                _IsEditingMode = value;
958
                OnPropertyChanged("IsEditingMode");
959
            }
960
        }
1018 961

  
1019 962
        public PathGeometry PathGeometry
1020 963
        {
......
1133 1076
            {
1134 1077
                instance.SetValue(e.Property, e.NewValue);
1135 1078

  
1136
                //if (instance.EnableEditing)
1137
                //{
1138
                //    instance.EditingMode();
1139
                //}
1140
                //else
1141
                //{
1142
                //    instance.UnEditingMode();
1143
                //}
1079
                if (instance.EnableEditing)
1080
                {
1081
                    instance.EditingMode();
1082
                }
1083
                else
1084
                {
1085
                    instance.UnEditingMode();
1086
                }
1144 1087
            }
1145 1088
        }
1146 1089

  

내보내기 Unified diff

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