Browse Source

ComPDFKit.Tool(Win) - 增加表单创建时通知事件

liyuxuan 6 tháng trước cách đây
mục cha
commit
6b0d17811c

+ 1 - 0
Demo/Examples/ComPDFKit.Tool/CPDFToolManager.cs

@@ -2194,6 +2194,7 @@ namespace ComPDFKit.Tool
                         {
                             cPDFAnnotation = viewerTool.StartDrawWidget(createWidgetType);
                             viewerTool.CreateDefaultWidget(cPDFAnnotation, createWidgetType, null);
+                            viewerTool?.InvokeWidgetCreated(cPDFAnnotation);
                         }
                         else if (currentToolType == ToolType.Pan || currentToolType == ToolType.Viewer)
                         {

+ 9 - 0
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.WidgetTool.cs

@@ -39,6 +39,7 @@ namespace ComPDFKit.Tool
         public static DependencyProperty PopupAttachDataProperty = DependencyProperty.Register("PopupAttachData", typeof(BaseAnnot), typeof(CPDFViewerTool));
 
         public event EventHandler<WidgetClickArgs> WidgetActionHandler;
+        public event EventHandler<CPDFAnnotation> WidgetCreatedHandler;
 
         private CustomizeLayer formPopLayer=null;
         // Inner default pop-up control
@@ -871,5 +872,13 @@ namespace ComPDFKit.Tool
                 }
             }
         }
+
+        internal void InvokeWidgetCreated(CPDFAnnotation annot)
+        {
+            if(annot!=null && annot.IsValid())
+            {
+                WidgetCreatedHandler?.Invoke(this, annot);
+            }
+        }
     }
 }