|
@@ -1454,7 +1454,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
|
|
|
Border textBorder = new Border();
|
|
|
textBorder.Child = textui;
|
|
|
- textui.Width = 200;
|
|
|
+
|
|
|
CTextAttribute textAttribute = annotFreeText.FreeTextDa;
|
|
|
byte transparency = annotFreeText.GetTransparency();
|
|
|
textui.FontSize = DpiHelper.PDFNumToStandardNum(textAttribute.FontSize * zoomFactor);
|
|
@@ -1476,15 +1476,28 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
{
|
|
|
backgroundColor = Color.FromRgb(annotFreeText.BgColor[0], annotFreeText.BgColor[1], annotFreeText.BgColor[2]);
|
|
|
}
|
|
|
- Point MousePoint = new Point((mouseStartPoint.X - pageBound.X), (mouseStartPoint.Y - pageBound.Y));
|
|
|
- textBorder.MaxWidth = (pageBound.Width - MousePoint.X - cropPoint.X);
|
|
|
- textBorder.MaxHeight = (pageBound.Height - MousePoint.Y - cropPoint.Y);
|
|
|
|
|
|
+ Point MousePoint = new Point((mouseStartPoint.X - pageBound.X), (mouseStartPoint.Y - pageBound.Y));
|
|
|
textui.Foreground = new SolidColorBrush(textColor);
|
|
|
textui.Background = new SolidColorBrush(backgroundColor);
|
|
|
+
|
|
|
+ textBorder.MaxWidth =(pageBound.Width - MousePoint.X - cropPoint.X);
|
|
|
+ textBorder.MaxHeight =(pageBound.Height - MousePoint.Y - cropPoint.Y);
|
|
|
textui.MinHeight = 40;
|
|
|
textui.MinWidth = 200;
|
|
|
|
|
|
+ if(string.IsNullOrEmpty(annotFreeText.Content)==false)
|
|
|
+ {
|
|
|
+ textBorder.MaxWidth = Math.Max(200, (pageBound.Width - MousePoint.X - cropPoint.X));
|
|
|
+ textBorder.MaxHeight = Math.Max(40, (pageBound.Height - MousePoint.Y - cropPoint.Y));
|
|
|
+ textBorder.MinWidth = 200;
|
|
|
+ textBorder.MinHeight = 40;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ textui.Width = 150;
|
|
|
+ }
|
|
|
+
|
|
|
textBorder.Padding = new Thickness(0);
|
|
|
textBorder.BorderBrush = new SolidColorBrush(borderColor);
|
|
|
textBorder.BorderThickness = new Thickness(DpiHelper.PDFNumToStandardNum(annotFreeText.GetBorderWidth() * zoomFactor));
|
|
@@ -1493,7 +1506,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
|
|
|
string fontName = string.Empty;
|
|
|
string fontFamily = string.Empty;
|
|
|
- CPDFFont.GetFamlyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
|
|
|
+ CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
|
|
|
textui.FontFamily = new FontFamily(fontFamily);
|
|
|
|
|
|
textui.AcceptsReturn = true;
|
|
@@ -1722,7 +1735,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
|
|
|
string fontName = string.Empty;
|
|
|
string fontFamily = string.Empty;
|
|
|
- CPDFFont.GetFamlyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
|
|
|
+ CPDFFont.GetFamilyStyleName(annotFreeText.FreeTextDa.FontName, ref fontFamily, ref fontName);
|
|
|
lastTextui.FontFamily = new FontFamily(fontFamily);
|
|
|
|
|
|
lastTextui.FontWeight = IsBold(textAttribute.FontName) ? FontWeights.Bold : FontWeights.Normal;
|