Jelajahi Sumber

ComPDFKit.Tool(Win) - 调整更新弹出文字框逻辑

liyuxuan 2 bulan lalu
induk
melakukan
a7231125a1

+ 4 - 2
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.Annot.cs

@@ -872,8 +872,10 @@ namespace ComPDFKit.Tool
                     textBorder.BorderBrush = new SolidColorBrush(borderColor);
                     textBorder.BorderThickness = new Thickness(DpiHelper.PDFNumToStandardNum(textWidget.GetBorderWidth() * annotData.CurrentZoom));
                     textui.BorderThickness = new Thickness(0);
-                    textui.Text = textWidget.Content;
-
+                    if (string.IsNullOrEmpty(textui.Text) == false)
+                    {
+                        textui.CaretIndex = textui.Text.Length;
+                    }
                     textui.FontFamily = new FontFamily(GetFontName(textAttribute.FontName));
                     textui.FontWeight = IsBold(textAttribute.FontName) ? FontWeights.Bold : FontWeights.Normal;
                     textui.FontStyle = IsItalic(textAttribute.FontName) ? FontStyles.Italic : FontStyles.Normal;

+ 0 - 1
Demo/Examples/ComPDFKit.Tool/DrawTool/CreateAnnotTool.cs

@@ -1469,7 +1469,6 @@ namespace ComPDFKit.Tool.DrawTool
                     CPDFFreeTextAnnotation annotFreeText = (cPDFAnnotation as CPDFFreeTextAnnotation);
 
                     TextBox textui = new TextBox();
-                    textui.Name = "PdfViewerTextBox";
                     DashedBorder textBorder = new DashedBorder();
                     textBorder.Child = textui;
                     textui.Width = 200;