Browse Source

【Form】先设置文本域的属性,再添加文本域到页面上,不是刚刚修改的属性 -- 修复

lizhe 10 months ago
parent
commit
cb41dc38d9

+ 18 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -3594,6 +3594,24 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
             break;
         case CAnnotationTypeTextField:{
             CPDFTextWidgetAnnotation *textWidget = [[CPDFTextWidgetAnnotation alloc] initWithKMNoteBounds:bounds document:self.document];
+            textWidget.stringValue = NSLocalizedString(@"", nil);
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationTextWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                textWidget.backgroundColor = backgroundColor;
+            } else {
+                textWidget.backgroundColor = [NSColor clearColor];
+            }
+            
+            NSColor* fontColor = [sud colorForKey:@"SKAnnotationTextWidgetFontColorKey"];
+            if (fontColor) {
+                textWidget.fontColor = fontColor;
+            }
+            textWidget.alignment = [sud integerForKey:@"SKAnnotationTextWidgetAlignmenKey"];
+            NSFont *font = [sud fontForNameKey:SKAnnotationTextWidgetFontNameKey sizeKey:@"SKAnnotationTextWidgetFontSizeKey"];
+            if (font) {
+                textWidget.font = font;
+            }
+            textWidget.isMultiline = [sud boolForKey:@"SKAnnotationTextMultilineKey"];
             newAnnotation = textWidget;
         }
             break;