Browse Source

Merge branch 'compdfkit_demo_windows' of http://git.kdan.cc:8865/Others/kmpdfkit_demo into compdfkit_demo_windows

zhuyi 1 year ago
parent
commit
d811cbc7a5
31 changed files with 1166 additions and 178 deletions
  1. 61 10
      compdfkit_demo_windows/compdfkit/annotation-ctrl-demo/MainWindow.xaml
  2. 83 10
      compdfkit_demo_windows/compdfkit/annotation-ctrl-demo/MainWindow.xaml.cs
  3. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateSignatureDialog.xaml
  4. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateStampDialog.xaml
  5. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/BarControl/CPDFAnnotationBarControl.xaml
  6. 0 56
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/BarControl/CPDFAnnotationBarControl.xaml.cs
  7. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/Convert/UnVisivleConvert.cs
  8. 4 4
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PasswordControl/PasswordDialog.xaml
  9. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PropertyControl/ColorPickerControl.xaml
  10. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml
  11. 14 4
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs
  12. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml
  13. 3 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml.cs
  14. 1 4
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextStyleUI.xaml
  15. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextStyleUI.xaml.cs
  16. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml
  17. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsUI/CPDFViewModeUI.xaml
  18. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFAbstractInfoControl.xaml
  19. 3 3
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFCreateInfoControl.xaml
  20. 7 7
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFSecurityInfoControl.xaml
  21. 2 2
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFSecurityInfoControl.xaml.cs
  22. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFOutline/PDFOutlineUI/CPDFOutlineUI.xaml
  23. 1 1
      compdfkit_demo_windows/compdfkit/compdfkit-tools/compdfkit-tools.csproj
  24. 98 7
      compdfkit_demo_windows/compdfkit/compdfkit/MainWindow.xaml
  25. 813 15
      compdfkit_demo_windows/compdfkit/compdfkit/MainWindow.xaml.cs
  26. 1 0
      compdfkit_demo_windows/compdfkit/compdfkit/compdfkit.csproj
  27. 1 3
      compdfkit_demo_windows/compdfkit/edit-ctrl-demo/MainWindow.xaml
  28. 44 21
      compdfkit_demo_windows/compdfkit/edit-ctrl-demo/MainWindow.xaml.cs
  29. 5 5
      compdfkit_demo_windows/compdfkit/form-ctrl-demo/MainWindow.xaml.cs
  30. 1 1
      compdfkit_demo_windows/compdfkit/viewer-ctrl-demo/MainWindow.xaml
  31. 6 6
      compdfkit_demo_windows/compdfkit/viewer-ctrl-demo/MainWindow.xaml.cs

+ 61 - 10
compdfkit_demo_windows/compdfkit/annotation-ctrl-demo/MainWindow.xaml

@@ -64,8 +64,8 @@
                     </Button>
 
                     <!--保存文件-->
-                    <Button BorderThickness="0" VerticalContentAlignment="Center" Margin="10,0,0,0" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" 
-                            Click="SaveFileBtn_Click">
+                    <Button BorderThickness="0" VerticalContentAlignment="Center" Margin="10,0,0,0" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent"  
+                            Click="SaveFileBtn_Click"  IsEnabled="{Binding CanSave,Mode=OneWay}">
                         <Button.Content>
                             <Viewbox Width="20" Height="20">
                                 <Path Fill="#43474D" >
@@ -217,6 +217,11 @@
             </Grid>
 
             <Grid Name="BodyGrid" Grid.Row="1">
+                 <Grid.RowDefinitions>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="*"/>
+                </Grid.RowDefinitions>
+                                <!--工具栏展开-->
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="0"></ColumnDefinition>
                     <ColumnDefinition Width="0"></ColumnDefinition>
@@ -224,13 +229,60 @@
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                 </Grid.ColumnDefinitions>
 
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="auto"/>
-                    <RowDefinition Height="*"/>
-                </Grid.RowDefinitions>
-                <!--工具栏展开-->
-
-                <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded" Grid.ColumnSpan="5" Height="44"/>
+                <Border x:Name="ToolBarContainer" Height="45" Visibility="Visible"  BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                        <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded" Height="44"/>
+                        <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+                        <!--撤销-->
+                        <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}"  Click="UndoButton_Click"
+                                    Background="Transparent">
+                            <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                                <Path.Style>
+                                    <Style TargetType="Path">
+                                        <Style.Triggers>
+                                            <Trigger Property="IsEnabled" Value="False">
+                                                <Setter Property="Fill" Value="LightGray"/>
+                                            </Trigger>
+                                            <Trigger Property="IsEnabled" Value="True">
+                                                <Setter Property="Fill" Value="#43474D"/>
+                                            </Trigger>
+                                        </Style.Triggers>
+                                    </Style>
+                                </Path.Style>
+                                <Path.Data>
+                                    M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                                </Path.Data>
+                            </Path>
+                        </Button>
+                        <!--重做-->
+                        <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoButton_Click"
+                                    Background="Transparent">
+                            <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                                <Path.Resources>
+                                    <Style TargetType="Path">
+                                        <Style.Triggers>
+                                            <Trigger Property="IsEnabled" Value="False">
+                                                <Setter Property="Fill" Value="LightGray"/>
+                                            </Trigger>
+                                            <Trigger Property="IsEnabled" Value="True">
+                                                <Setter Property="Fill" Value="#43474D"/>
+                                            </Trigger>
+                                        </Style.Triggers>
+                                    </Style>
+                                </Path.Resources>
+                                <Path.Data>
+                                    M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                                </Path.Data>
+                            </Path>
+                        </Button>
+                    </StackPanel>
+                    
+                </Border>
+                   
                 <Grid Grid.Row="1" Name="ExpandToolContainer" Visibility="Collapsed">
                     <Grid.RowDefinitions>
                         <RowDefinition Height="auto"></RowDefinition>
@@ -297,7 +349,6 @@
                         </ToggleButton>
 
                     </StackPanel>
-
                     <Border  Grid.Row="1" Name="BotaToolContainer"></Border>
                 </Grid>
 

+ 83 - 10
compdfkit_demo_windows/compdfkit/annotation-ctrl-demo/MainWindow.xaml.cs

@@ -26,14 +26,53 @@ namespace viewer_ctrl_demo
     /// <summary>
     /// Interaction logic for MainWindow.xaml
     /// </summary>
-    public partial class MainWindow : Window
+    public partial class MainWindow : Window, INotifyPropertyChanged
     {
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl;
         private CPDFAnnotationControl pdfAnnotationControl = null;
 
+
         private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
 
+        public bool CanSave
+        {
+            get
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                {
+                    return pdfViewControl.PDFView.UndoManager.CanSave;
+                }
+                return false;
+            }
+        }
+
+        public bool CanUndo
+        {
+            get
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                {
+                    return pdfViewControl.PDFView.UndoManager.CanUndo;
+                }
+                return false;
+            }
+        }
+
+        public bool CanRedo
+        {
+            get
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                {
+                    return pdfViewControl.PDFView.UndoManager.CanRedo;
+                }
+                return false;
+            }
+        }
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
         public MainWindow()
         {
             InitializeComponent();
@@ -66,6 +105,8 @@ namespace viewer_ctrl_demo
             pdfViewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
             pdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
             pdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+            pdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged; 
             PasswordUI.Closed -= PasswordUI_Closed;
             PasswordUI.Canceled -= PasswordUI_Canceled;
             PasswordUI.Confirmed -= PasswordUI_Confirmed;
@@ -100,6 +141,11 @@ namespace viewer_ctrl_demo
             InitialPDFViewControl(pdfViewControl);
         }
 
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+        }
+
         private void PDFView_AnnotCommandHandler(object sender, ComPDFKitViewer.AnnotEvent.AnnotCommandArgs e)
         {
             switch (e.CommandType)
@@ -174,7 +220,7 @@ namespace viewer_ctrl_demo
                             {
                                 if (pdfViewControl != null)
                                 {
-                                    double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                                    double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
                                     pdfViewControl.PDFView?.Zoom(newZoom);
                                 }
                             };
@@ -187,7 +233,7 @@ namespace viewer_ctrl_demo
                             {
                                 if (pdfViewControl != null)
                                 {
-                                    double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                                    double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
                                     pdfViewControl.PDFView?.Zoom(newZoom);
                                 }
                             };
@@ -208,7 +254,7 @@ namespace viewer_ctrl_demo
                             e.PopupMenu.Items.Add(singleView);
 
                             MenuItem singleContinuousView = new MenuItem();
-                            singleContinuousView.Header = "Single Continuous Page";
+                            singleContinuousView.Header = "Single Page Continuous";
                             singleContinuousView.Click += (o, p) =>
                             {
                                 if (pdfViewControl != null)
@@ -220,7 +266,7 @@ namespace viewer_ctrl_demo
                             e.PopupMenu.Items.Add(singleContinuousView);
 
                             MenuItem doubleView = new MenuItem();
-                            doubleView.Header = "Double Page";
+                            doubleView.Header = "Two Pages";
                             doubleView.Click += (o, p) =>
                             {
                                 if (pdfViewControl != null)
@@ -232,7 +278,7 @@ namespace viewer_ctrl_demo
                             e.PopupMenu.Items.Add(doubleView);
 
                             MenuItem doubleContinuousView = new MenuItem();
-                            doubleContinuousView.Header = "Double Continuous Page";
+                            doubleContinuousView.Header = "Two Pages Continuous";
                             doubleContinuousView.Click += (o, p) =>
                             {
                                 if (pdfViewControl != null)
@@ -364,7 +410,7 @@ namespace viewer_ctrl_demo
                 }
                 else
                 {
-                    PasswordUI.SetShowError("error", Visibility.Visible);
+                    PasswordUI.SetShowError("Wrong Password", Visibility.Visible);
                 }
             }
         }
@@ -768,7 +814,6 @@ namespace viewer_ctrl_demo
             AnnotationBarControl.InitAnnotationBar(annotationProperties);
             AnnotationBarControl.AnnotationPropertyChanged += AnnotationBarControl_AnnotationPropertyChanged;
             AnnotationBarControl.AnnotationCancel += AnnotationBarControl_AnnotationCancel;
-            AnnotationBarControl.UndoRedoEvent += AnnotationBarControl_UndoRedoEvent;
         }
 
         private void AnnotationBarControl_UndoRedoEvent(object sender, string e)
@@ -838,6 +883,10 @@ namespace viewer_ctrl_demo
             PropertyContainer.Width = 260;
             PropertyContainer.Child = properytPanel;
             PropertyContainer.Visibility = visible;
+            if (visible == Visibility.Collapsed||visible == Visibility.Hidden)
+            {
+                AnnotationBarBtn.IsChecked = false;
+            }
         }
 
         private void EditLink_Click(object sender, RoutedEventArgs e)
@@ -851,15 +900,39 @@ namespace viewer_ctrl_demo
             if ((string)item.Content == "Viewer")
             {
                 AnnotationBarControl.ClearAllToolState();
-                AnnotationBarControl.Visibility = Visibility.Collapsed;
+                ToolBarContainer.Visibility = Visibility.Collapsed;
                 ExpandRightPropertyPanel(null, Visibility.Collapsed);
                 pdfAnnotationControl.AnnotationCancel();
                 AnnotationBarBtn.IsChecked = false;
             }
             else if ((string)item.Content == "Annotation")
             {
-                AnnotationBarControl.Visibility = Visibility.Visible;
+                ToolBarContainer.Visibility = Visibility.Visible;
             }
         }
+
+        private void UndoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null)
+            {
+                pdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void RedoButton_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null)
+            {
+                pdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        /// <summary>
+        ///触发属性更改事件通知
+        /// </summary>
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
     }
 }

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateSignatureDialog.xaml

@@ -15,7 +15,7 @@
                 <ResourceDictionary Source="pack://application:,,,/compdfkit-assets;component/Styles/ButtonStyle.xaml"></ResourceDictionary>
                 <ResourceDictionary Source="pack://application:,,,/compdfkit-assets;component/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
-            <convert:UnVisivleConvert x:Key="UnVisivleConvert"/>
+            <convert:ReverseVisibilityConvert x:Key="ReverseVisibilityConvert"/>
             <SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFF"/>
             <SolidColorBrush x:Key="TabItem.Selected.Border" Color="#ACACAC"/>
             <Style x:Key="TabControlStyle1" TargetType="{x:Type TabControl}">
@@ -421,7 +421,7 @@
                             <TextBlock Text="or"  HorizontalAlignment="Center"/>
                             <Button  x:Name="AddImageBtn" Style="{DynamicResource LinkButton}" HorizontalAlignment="Center" Content="Select a File" Click="OpenImage_Click"/>
                         </StackPanel>
-                        <Image x:Name="ImageImage" SourceUpdated="ImageImage_SourceUpdated" Grid.RowSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.ColumnSpan="4" Visibility="{Binding ElementName=AddImageBtn,Path=Visibility, Converter={StaticResource UnVisivleConvert}}"/>
+                        <Image x:Name="ImageImage" SourceUpdated="ImageImage_SourceUpdated" Grid.RowSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.ColumnSpan="4" Visibility="{Binding ElementName=AddImageBtn,Path=Visibility, Converter={StaticResource ReverseVisibilityConvert}}"/>
                     </Grid>
                 </Grid>
             </TabItem>

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationPanel/PDFAnnotationUI/CPDFCreateStampDialog.xaml

@@ -16,7 +16,7 @@
             <ResourceDictionary.MergedDictionaries>
                 <ResourceDictionary Source="pack://application:,,,/compdfkit-assets;component/Styles/ButtonStyle.xaml"></ResourceDictionary>
             </ResourceDictionary.MergedDictionaries>
-            <convert:UnVisivleConvert x:Key="UnVisivleConvert"/>
+            <convert:ReverseVisibilityConvert x:Key="ReverseVisibilityConvert"/>
             <SolidColorBrush x:Key="TabItem.Selected.Background" Color="#FFFFFF"/>
             <SolidColorBrush x:Key="TabItem.Selected.Border" Color="#ACACAC"/>
             <Style x:Key="TabControlStyle1" TargetType="{x:Type TabControl}">
@@ -391,7 +391,7 @@
                             <TextBlock Text="or"  HorizontalAlignment="Center"/>
                             <Button  x:Name="AddImageBtn" Style="{DynamicResource LinkButton}" HorizontalAlignment="Center" Content="Select a File" Click="OpenImage_Click"/>
                         </StackPanel>
-                        <Image x:Name="ImageImage" SourceUpdated="ImageImage_SourceUpdated" Grid.RowSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.ColumnSpan="4" Visibility="{Binding ElementName=AddImageBtn,Path=Visibility, Converter={StaticResource UnVisivleConvert}}"/>
+                        <Image x:Name="ImageImage" SourceUpdated="ImageImage_SourceUpdated" Grid.RowSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.ColumnSpan="4" Visibility="{Binding ElementName=AddImageBtn,Path=Visibility, Converter={StaticResource ReverseVisibilityConvert}}"/>
                     </Grid>
                 </Grid>
             </TabItem>

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/BarControl/CPDFAnnotationBarControl.xaml

@@ -8,7 +8,7 @@
     <UserControl.Resources>
         <ResourceDictionary Source="../../Asset/Theme/LightMode.xaml"></ResourceDictionary>
     </UserControl.Resources>
-    <Border BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5">
+    <Border Background="#F2F3F5">
         <Grid  Name="AnnotationGrid" Width="0"></Grid>
     </Border>
 </UserControl>

+ 0 - 56
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/BarControl/CPDFAnnotationBarControl.xaml.cs

@@ -26,7 +26,6 @@ namespace compdfkit_tools.PDFControl
         private Brush brush = null;
 
         public event EventHandler<CPDFAnnotationType> AnnotationPropertyChanged;
-        public event EventHandler<string> UndoRedoEvent;
         public event EventHandler AnnotationCancel;
 
         public CPDFAnnotationBarControl()
@@ -289,54 +288,6 @@ namespace compdfkit_tools.PDFControl
            
         }
 
-        private void CreateUndoRedoButton()
-        {
-            AnnotationGrid.Width += 100;
-            AnnotationGrid.ColumnDefinitions.Add(new ColumnDefinition());
-            AnnotationGrid.ColumnDefinitions.Add(new ColumnDefinition());
-            Button UndoButton = new Button();
-
-            Button RedoButton = new Button();
-
-            UndoButton.Background = Brushes.Transparent;
-            UndoButton.BorderBrush = Brushes.Transparent;
-
-            RedoButton.Background = Brushes.Transparent;
-            RedoButton.BorderBrush = Brushes.Transparent;
-
-            Geometry undoGeometry = Geometry.Parse("M3.53033 7.62131L3 8.15164L3.53033 8.68197L7.15164 12.3033L8.2123 11.2426L5.87132 8.90164H12.5607C14.0794 8.90164 15.3107 10.1329 15.3107 11.6516C15.3107 13.1704 14.0794 14.4016 12.5607 14.4016H5.06066V15.9016H12.5607C14.9079 15.9016 16.8107 13.9988 16.8107 11.6516C16.8107 9.30443 14.9079 7.40164 12.5607 7.40164H5.87132L8.2123 5.06066L7.15164 4L3.53033 7.62131Z");
-            Path undoPath = new Path
-            {
-                Width = 20,
-                Height = 20,
-                Data = undoGeometry,
-                Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#43474D"))
-            };
-
-            Geometry redoGeometry = Geometry.Parse("M16.2802 7.62131L16.8105 8.15164L16.2802 8.68197L12.6589 12.3033L11.5982 11.2426L13.9392 8.90164H7.24989C5.7311 8.90164 4.49989 10.1329 4.49989 11.6516C4.49989 13.1704 5.7311 14.4016 7.24989 14.4016H14.7499V15.9016H7.24989C4.90268 15.9016 2.99989 13.9988 2.99989 11.6516C2.99989 9.30443 4.90268 7.40164 7.24989 7.40164H13.9392L11.5982 5.06066L12.6589 4L16.2802 7.62131Z");
-            Path redoPath = new Path
-            {
-                Width = 20,
-                Height = 20,
-                Data = redoGeometry,
-                Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#43474D"))
-            };
-
-            UndoButton.Content = undoPath;
-            RedoButton.Content = redoPath;
-
-            UndoButton.Tag = "Undo";
-            RedoButton.Tag = "Redo";
-
-            Grid.SetColumn(UndoButton, annotationCounter++);
-            UndoButton.Click += UndoRedoButton_Click;
-            AnnotationGrid.Children.Add(UndoButton);
-
-            Grid.SetColumn(RedoButton, annotationCounter++);
-            RedoButton.Click += UndoRedoButton_Click;
-            AnnotationGrid.Children.Add(RedoButton);
-        }
-
         public void ClearAllToolState()
         {
             foreach (UIElement child in AnnotationGrid.Children)
@@ -373,12 +324,6 @@ namespace compdfkit_tools.PDFControl
             }
         }
 
-        private void UndoRedoButton_Click(object sender, RoutedEventArgs e)
-        {
-            var button = sender as Button;
-            UndoRedoEvent?.Invoke(sender, (string)button.Tag);
-        }
-
         public void InitAnnotationBar(CPDFAnnotationType[] annotationProperties)
         {
             brush = (Brush)FindResource("btn.bg.bota");
@@ -391,7 +336,6 @@ namespace compdfkit_tools.PDFControl
                 CreateAnnotationButton(toggleButton);
                 AnnotationGrid.Width += 50;
             }
-            CreateUndoRedoButton();
         }
     }
 }

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/Convert/UnVisivleConvert.cs

@@ -9,7 +9,7 @@ using System.Windows.Data;
 
 namespace compdfkit_tools.Common.Convert
 {
-    public class UnVisivleConvert : IValueConverter
+    public class ReverseVisibilityConvert : IValueConverter
     {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
         {

+ 4 - 4
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PasswordControl/PasswordDialog.xaml

@@ -7,7 +7,7 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800" BorderBrush="Black" BorderThickness="1">
     
-    <Grid  Width="534" Height="206" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White">
+    <Grid  Width="534" Height="226" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White">
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="*"></ColumnDefinition>
             <ColumnDefinition Width="*"></ColumnDefinition>
@@ -18,7 +18,7 @@
             <RowDefinition Height="auto"></RowDefinition>
         </Grid.RowDefinitions>
 
-        <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Please enter the password:</TextBlock>
+        <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Password</TextBlock>
         
         <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="PasswordDialogClose_Click">
             <Button.Content>
@@ -44,8 +44,8 @@
 
             <TextBlock FontSize="14" Foreground="#43474D" Grid.Column="1" Name="FileEncryptText" VerticalAlignment="Center"></TextBlock>
 
-            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" Height="52" Margin="0,22,0,0" >
-                <TextBlock FontSize="14" Foreground="#43474D" Margin="0,-20,0,0"  VerticalAlignment="Center">Please enter the password:</TextBlock>
+            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" Height="62" Margin="0,22,0,0" >
+                <TextBlock FontSize="14" Foreground="#43474D" Margin="0,-30,0,0"  VerticalAlignment="Center">Please Enter the Password:</TextBlock>
                 <StackPanel Margin="8,0,0,0">
                     <PasswordBox Name="PasswordBoxText" Padding="5,0,0,0" Height="32" Width="185"  VerticalContentAlignment="Center" VerticalAlignment="Center"></PasswordBox>
                     <TextBlock Name="ErrorTipsText" Foreground="Red" Margin="0,4,0,0" Visibility="Collapsed"></TextBlock>

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PropertyControl/ColorPickerControl.xaml

@@ -7,7 +7,7 @@
              xmlns:local="clr-namespace:compdfkit_tools.Common" xmlns:convert="clr-namespace:compdfkit_tools.Common.Convert"
              d:DesignHeight="40" d:DesignWidth="220">
     <UserControl.Resources>
-        <convert:UnVisivleConvert x:Key="UnVisivleConvert"/>
+        <convert:ReverseVisibilityConvert x:Key="ReverseVisibilityConvert"/>
         <Style x:Key="TransparentRadioButton" TargetType="{x:Type RadioButton}">
             <Setter Property="HorizontalAlignment" Value="Center" />
             <Setter Property="VerticalAlignment" Value="Center" />
@@ -153,7 +153,7 @@
 
         <RadioButton  x:Name="TransparentBtn"  Background="Transparent" Style="{StaticResource TransparentRadioButton}" Tag="-1" Click="ColorRadioButton_Click" Visibility="{Binding TransparentBtnProperty, RelativeSource={RelativeSource AncestorType={x:Type local:ColorPickerControl}},Mode=TwoWay}"/>
 
-        <RadioButton  x:Name="FirstBtn"  Background="#000000" Style="{StaticResource CommonColorRadioButton}" Tag="0" Click="ColorRadioButton_Click" Visibility="{Binding ElementName=TransparentBtn, Path=Visibility, Converter={StaticResource UnVisivleConvert}}"/>
+        <RadioButton  x:Name="FirstBtn"  Background="#000000" Style="{StaticResource CommonColorRadioButton}" Tag="0" Click="ColorRadioButton_Click" Visibility="{Binding ElementName=TransparentBtn, Path=Visibility, Converter={StaticResource ReverseVisibilityConvert}}"/>
 
         <RadioButton  x:Name="SecondBtn"  Background="#FF0000" Grid.Column="1" Style="{StaticResource CommonColorRadioButton}" Tag="1" Click="ColorRadioButton_Click" />
 

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml

@@ -27,7 +27,7 @@
         </Grid.RowDefinitions>
 
         <Border Background="White" Height="36">
-            <TextBlock FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" Foreground="#42464D" VerticalAlignment="Center">Image</TextBlock>
+            <TextBlock FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" Foreground="#42464D" VerticalAlignment="Center">Image Properties</TextBlock>
         </Border>
 
         <Border Background="#E2E3E6" Grid.Row="1" MinHeight="100" CornerRadius="5" Margin="0,16,0,0" BorderThickness="1">

+ 14 - 4
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFImageEdit/PDFImageEditControl/PDFImageEditControl.xaml.cs

@@ -32,8 +32,14 @@ namespace compdfkit_tools.Edit
         {
             InitializeComponent();
             Loaded += PDFImageEditControl_Loaded;
+            Unloaded += PDFImageEditControl_Unloaded;
         }
 
+        private void PDFImageEditControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            RotateUI.RotationChanged -= RotateUI_RotationChanged;
+            FlipUI.FlipChanged -= FlipUI_FlipChanged;
+        }
 
         public void InitWithPDFViewer(CPDFViewer newPDFView)
         {
@@ -44,9 +50,7 @@ namespace compdfkit_tools.Edit
         {
             if (newEvent != null && newEvent.EditType == CPDFEditType.EditImage)
             {
-                ImasgeOpacitySlider.Value = newEvent.Transparency / 255D;
-                OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Ceiling(ImasgeOpacitySlider.Value * 100)));
-               
+                SetImageTransparency(newEvent.Transparency);
             }
             EditEvent = newEvent;
             SetImageThumb();
@@ -201,7 +205,7 @@ namespace compdfkit_tools.Edit
             }
         }
 
-        private void SetImageThumb()
+        public void SetImageThumb()
         {
             if (PDFView != null && EditEvent!=null)
             {
@@ -233,5 +237,11 @@ namespace compdfkit_tools.Edit
                 }
             }
         }
+
+        public void SetImageTransparency(double transparency)
+        {
+            ImasgeOpacitySlider.Value = transparency / 255D;
+            OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Ceiling(ImasgeOpacitySlider.Value * 100)));
+        }
     }
 }

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml

@@ -21,7 +21,7 @@
         </Grid.RowDefinitions>
         
         <Border Height="36" Background="White">
-            <TextBlock FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" LineHeight="17" VerticalAlignment="Center">Text</TextBlock>
+            <TextBlock FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" LineHeight="17" VerticalAlignment="Center">Text Properties</TextBlock>
         </Border>
 
         <Grid Grid.Row="1">
@@ -34,7 +34,7 @@
                 <RowDefinition Height="auto"></RowDefinition>
             </Grid.RowDefinitions>
 
-            <TextBlock Margin="0,20,0,0" Foreground="#0E1114" FontSize="14">Text Color:</TextBlock>
+            <TextBlock Margin="0,20,0,0" Foreground="#0E1114" FontSize="14">Font Color:</TextBlock>
 
             <common:ColorPickerControl x:Name="FontColorUI" Grid.Row="1" Margin="0,20,0,0" TransparentBtnProperty="Collapsed"></common:ColorPickerControl>
 

+ 3 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditControl/PDFTextEditControl.xaml.cs

@@ -38,7 +38,8 @@ namespace compdfkit_tools.Edit
 
         public void SetPDFTextEditData(PDFEditEvent newEvent)
         {
-            if(newEvent!=null && newEvent.EditType==CPDFEditType.EditText)
+            EditEvent = null;
+            if (newEvent!=null && newEvent.EditType==CPDFEditType.EditText)
             {
                 if (newEvent.SystemFontNameList.Contains(newEvent.FontName) == false && string.IsNullOrEmpty(newEvent.FontName)==false)
                 {
@@ -51,6 +52,7 @@ namespace compdfkit_tools.Edit
                 TextStyleUI.SetFontSize(newEvent.FontSize);
                 OpacityTextBox.Text = string.Format("{0}%", (int)(Math.Ceiling(newEvent.Transparency * 100/255D)));
                 TextAlignUI.SetFontAlign(newEvent.TextAlign);
+                FontColorUI.Brush = new SolidColorBrush(newEvent.FontColor);
             }
             EditEvent = newEvent;
         }

+ 1 - 4
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextStyleUI.xaml

@@ -19,7 +19,7 @@
             <RowDefinition Height="*"></RowDefinition>
         </Grid.RowDefinitions>
         <Border>
-            <TextBlock VerticalAlignment="Center" Margin="0,10,10,0" FontSize="14" Foreground="#43474D">Text:</TextBlock>
+            <TextBlock VerticalAlignment="Center" Margin="0,10,10,0" FontSize="14" Foreground="#43474D">Font Style:</TextBlock>
         </Border>
       
         <Grid Grid.Row="1" Margin="0,10,0,0">
@@ -35,9 +35,6 @@
             
             <ComboBox Grid.ColumnSpan="2" Name="FontNameComboBox" Width="228" Height="28" FontSize="14" SelectionChanged="FontNameComboBox_SelectionChanged" BorderThickness="1"
                       VerticalContentAlignment="Center" Foreground="#43474D" Style="{StaticResource ComboBoxStyle1}" >
-                <ComboBoxItem Content="Courier"></ComboBoxItem>
-                <ComboBoxItem Content="Helvetica"></ComboBoxItem>
-                <ComboBoxItem Content="Times"></ComboBoxItem>
             </ComboBox>
 
             <ComboBox Name="FontStyleBox" Width="148" Height="28" Grid.Row="1" Margin="0,8,0,0" BorderThickness="1" Foreground="#43474D" FontSize="14" 

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextStyleUI.xaml.cs

@@ -32,7 +32,7 @@ namespace compdfkit_tools.Edit
 
         public void SetFontNames(List<string> fontNames)
         {
-            FontNameComboBox.Items?.Clear();
+            FontNameComboBox.ItemsSource = null;
             if (fontNames != null && fontNames.Count > 0)
             {
                 List<ComboBoxItem> fontNameList = new List<ComboBoxItem>();

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml

@@ -14,7 +14,7 @@
         </Grid.RowDefinitions>
         
         <Border Height="40" BorderThickness="0,0,0,1" BorderBrush="#E0E0E0">
-            <TextBlock FontSize="16" LineHeight="24" Foreground="#42464D" VerticalAlignment="Center" HorizontalAlignment="Center">Preview settings</TextBlock>
+            <TextBlock FontSize="16" LineHeight="24" Foreground="#42464D" VerticalAlignment="Center" HorizontalAlignment="Center">View Setting</TextBlock>
         </Border>
 
         <Border Grid.Row="1" Background="#FAFCFF">

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsUI/CPDFViewModeUI.xaml

@@ -149,10 +149,10 @@
                         <ColumnDefinition Width="*"></ColumnDefinition>
                         <ColumnDefinition Width="auto"></ColumnDefinition>
                     </Grid.ColumnDefinitions>
-                    <TextBlock FontSize="14" Foreground="#43474D">Continuous Page Flip</TextBlock>
+                    <TextBlock FontSize="14" Foreground="#43474D">Continuous Scroll</TextBlock>
                     <ToggleButton Name="ContinuePageBtn" Style="{StaticResource ToggleButtonSwitchStyle}" Margin="0,0,33,0" Grid.Column="1" Width="40" BorderThickness="0"
                                   Click="ContinuePageBtn_Click"></ToggleButton>
-                    <TextBlock FontSize="14" Foreground="#43474D" Grid.Row="1" Margin="0,24,0,0">Crop Mode</TextBlock>
+                    <TextBlock FontSize="14" Foreground="#43474D" Grid.Row="1" Margin="0,24,0,0">Crop</TextBlock>
                     <ToggleButton Name="CropModeBtn" Style="{StaticResource ToggleButtonSwitchStyle}"  Margin="0,24,33,0" Grid.Row="1"  Grid.Column="1" Width="40" BorderThickness="0"
                                   Click="CropModeBtn_Click"></ToggleButton>
                 </Grid>

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFAbstractInfoControl.xaml

@@ -8,7 +8,7 @@
         <StackPanel Orientation="Vertical" Margin="19,12,0,0">
             
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Name:"></TextBlock>
+                <TextBlock Text="File Name:"></TextBlock>
                 <TextBlock x:Name="FileNameTextBlock" TextWrapping="NoWrap" Margin="4,0,0,0" Foreground="#999999"/>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
@@ -24,7 +24,7 @@
                 <TextBlock x:Name="AuthorTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Theme:"></TextBlock>
+                <TextBlock Text="Subject:"></TextBlock>
                 <TextBlock x:Name="SubjectTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">

+ 3 - 3
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFCreateInfoControl.xaml

@@ -5,7 +5,7 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:compdfkit_tools"
              mc:Ignorable="d">
-    <GroupBox Header="Creation">
+    <GroupBox Header="Create Information">
         <StackPanel Orientation="Vertical" Margin="19,12,0,0">
             
             <StackPanel Orientation="Horizontal"  Height="30">
@@ -21,11 +21,11 @@
                 <TextBlock x:Name="CreatorTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Date created:"></TextBlock>
+                <TextBlock Text="Creation Date:"></TextBlock>
                 <TextBlock x:Name="CreationDateTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Date modified:"></TextBlock>
+                <TextBlock Text="Modification Date:"></TextBlock>
                 <TextBlock x:Name="ModificationDateTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
         </StackPanel>

+ 7 - 7
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFSecurityInfoControl.xaml

@@ -5,30 +5,30 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:compdfkit_tools"
              mc:Ignorable="d">
-    <GroupBox Header="Access">
+    <GroupBox Header="Access Permissions">
         <StackPanel Orientation="Vertical" Margin="19,12,0,0">
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Print:"></TextBlock>
+                <TextBlock Text="Printing:"></TextBlock>
                 <TextBlock x:Name="AllowsPrintingTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Allow Copy:" ></TextBlock>
+                <TextBlock Text="Content Copying:" ></TextBlock>
                 <TextBlock x:Name="AllowsCopyingTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Allow Change:"></TextBlock>
+                <TextBlock Text="Document Change:"></TextBlock>
                 <TextBlock x:Name="AllowsDocumentChangesTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Document Portfolio:"></TextBlock>
+                <TextBlock Text="Document Assembly:"></TextBlock>
                 <TextBlock x:Name="AllowsDocumentAssemblyTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Allow Annotations:"></TextBlock>
+                <TextBlock Text="Commenting:"></TextBlock>
                 <TextBlock x:Name="AllowsCommentingTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
             <StackPanel Orientation="Horizontal"  Height="30">
-                <TextBlock Text="Fill and Froms:"></TextBlock>
+                <TextBlock Text="Filling of Form Field:"></TextBlock>
                 <TextBlock x:Name="AllowsFormFieldEntryTextBlock" Margin="4,0,0,0" Foreground="#999999"></TextBlock>
             </StackPanel>
         </StackPanel>

+ 2 - 2
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFInfo/CPDFSecurityInfoControl.xaml.cs

@@ -22,8 +22,8 @@ namespace compdfkit_tools.PDFControl
     /// </summary>
     public partial class CPDFSecurityInfoControl : UserControl
     {
-        private string T_Allowed = "allowed";
-        private string T_NotAllowed = "not allowed";
+        private string T_Allowed = "Allowed";
+        private string T_NotAllowed = "Not Allowed";
 
         public CPDFViewer pdfViewer;
         public void InitWithPDFViewer(CPDFViewer pdfViewer)

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/PDFView/PDFOutline/PDFOutlineUI/CPDFOutlineUI.xaml

@@ -20,7 +20,7 @@
             <RowDefinition Height="*"></RowDefinition>
         </Grid.RowDefinitions>
         <Border Height="50">
-            <TextBlock Foreground="#43474D" VerticalAlignment="Center" Margin="16,0,0,0" FontSize="14">Outline</TextBlock>
+            <TextBlock Foreground="#43474D" VerticalAlignment="Center" Margin="16,0,0,0" FontSize="14">Outlines</TextBlock>
         </Border>
 
         <Grid Grid.Row="1">

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/compdfkit-tools.csproj

@@ -95,7 +95,7 @@
       <DependentUpon>CPDFDeleteDialog.xaml</DependentUpon>
     </Compile>
     <Compile Include="Common\Convert\IntAndTagToBoolMultiBinding.cs" />
-    <Compile Include="Common\Convert\UnVisivleConvert.cs" />
+    <Compile Include="Common\Convert\ReverseVisibilityConvert.cs" />
     <Compile Include="Common\PasswordControl\PasswordDialog.xaml.cs">
       <DependentUpon>PasswordDialog.xaml</DependentUpon>
     </Compile>

+ 98 - 7
compdfkit_demo_windows/compdfkit/compdfkit/MainWindow.xaml

@@ -62,7 +62,7 @@
 
                     <!--保存文件-->
                     <Button BorderThickness="0" VerticalContentAlignment="Center" Margin="10,0,0,0" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" 
-                            Click="SaveFileBtn_Click">
+                            Click="SaveFileBtn_Click" IsEnabled="{Binding CanSave,Mode=OneWay}">
                         <Button.Content>
                             <Viewbox Width="20" Height="20">
                                 <Path Fill="#43474D" >
@@ -160,7 +160,8 @@
                             </Path>
                         </ToggleButton.Content>
                     </ToggleButton>
-
+                    
+                    <!--右侧属性面板开关-->
                     <ToggleButton  x:Name="RightPanelButton" BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="RightPanelButton_Click">
                         <ToggleButton.Content>
                             <Path Fill="#43474D" Width="30" Height="30">
@@ -189,14 +190,106 @@
                 </StackPanel>
             </Grid>
             <Grid Name="BodyGrid" Grid.Row="1">
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="*"/>
+                </Grid.RowDefinitions>
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="0"></ColumnDefinition>
                     <ColumnDefinition Width="0"></ColumnDefinition>
                     <ColumnDefinition Width="*"></ColumnDefinition>
                     <ColumnDefinition Width="auto"></ColumnDefinition>
                 </Grid.ColumnDefinitions>
+                <Border x:Name="ToolBarContainer" Height="45" Visibility="Collapsed"  BorderThickness="1" BorderBrush="#1A000000" Background="#F2F3F5" Grid.ColumnSpan="4">
+                    <Grid>
+                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                            <Grid>
+                                <cpdftools:CPDFAnnotationBarControl x:Name="AnnotationBarControl" Height="44" Loaded="AnnotationBarControl_Loaded" Unloaded="AnnotationBarControl_Unloaded"/>
+                                <Border Name="PDFEditTool" Background="#F2F3F5" Visibility="Collapsed">
+                                    <StackPanel  Orientation="Horizontal" HorizontalAlignment="Center">
+                                        <!--文字编辑按钮-->
+                                        <ToggleButton Style="{StaticResource ToggleButtonStyle}" Name="PDFTextEditButton" BorderThickness="0" Padding="10,5,10,5" Click="PDFTextEditButton_Click" Width="99" Height="40">
+                                            <StackPanel Orientation="Horizontal">
+                                                <Path Fill="#273C62" VerticalAlignment="Center">
+                                                    <Path.Data>
+                                                        M1.25 0H0.5V0.75V13.25V14H1.25H17.75H18.5V13.25V7H17V12.5H2V1.5H12.5V0H1.25ZM11.5 5V2.5H3.5V5H5V4H6.75V10H6V11.5H9V10H8.25V4H10V5H11.5ZM15.75 
+                                3.75H13.5V2.25H15.75V0H17.25V2.25H19.5V3.75H17.25V6H15.75V3.75Z
+                                                    </Path.Data>
+                                                </Path>
+                                                <TextBlock  FontSize="12" VerticalAlignment="Center" Margin="8,0,0,0">Add Text</TextBlock>
+                                            </StackPanel>
+                                        </ToggleButton>
+
+                                        <!--图片编辑按钮-->
+                                        <ToggleButton Style="{StaticResource ToggleButtonStyle}" Name="PDFImageEditButton" BorderThickness="0" Padding="10,5,10,5" Margin="10,0,0,0" Click="PDFImageEditButton_Click">
+                                            <StackPanel Orientation="Horizontal">
+                                                <Path Fill="#273C62" VerticalAlignment="Center">
+                                                    <Path.Data>
+                                                        M1.5 0H0.75V0.75V13.25V14H1.5H18H18.75V13.25V7H17.25V12.5H17.2147L11.8718 7.81776L9.56428 10.25L5.29496 6.75L2.25 9.95948V1.5H12.75V0H1.5ZM13.5 5.25C13.5 
+                                            6.07843 12.8284 6.75 12 6.75C11.1716 6.75 10.5 6.07843 10.5 5.25C10.5 4.42157 11.1716 3.75 12 3.75C12.8284 3.75 13.5 4.42157 13.5 5.25ZM15.75 
+                                            3.75H13.5V2.25H15.75V0H17.25V2.25H19.5V3.75H17.25V6H15.75V3.75Z
+                                                    </Path.Data>
+                                                </Path>
+                                                <TextBlock  FontSize="12" VerticalAlignment="Center" Margin="8,0,0,0">Add Picture</TextBlock>
+                                            </StackPanel>
+                                        </ToggleButton>
+                                    </StackPanel>
+                                </Border>
+                            </Grid>
+                            <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+                            <!--撤销-->
+                            <Button Name="UndoBtn" Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}" Click="UndoBtn_Click"
+                                    Background="Transparent">
+                                <Path x:Name="UndoPath" IsEnabled="{Binding CanUndo,Mode=OneWay}">
+                                    <Path.Style>
+                                        <Style TargetType="Path">
+                                            <Style.Triggers>
+                                                <Trigger Property="IsEnabled" Value="False">
+                                                    <Setter Property="Fill" Value="LightGray"/>
+                                                </Trigger>
+                                                <Trigger Property="IsEnabled" Value="True">
+                                                    <Setter Property="Fill" Value="#43474D"/>
+                                                </Trigger>
+                                            </Style.Triggers>
+                                        </Style>
+                                    </Path.Style>
+                                    <Path.Data>
+                                        M1.03033 3.62131L0.5 4.15164L1.03033 4.68197L4.65164 8.30328L5.7123 7.24261L3.37132 4.90164H10.0607C11.5794 4.90164 12.8107 6.13285 12.8107 
+                                7.65164C12.8107 9.17042 11.5794 10.4016 10.0607 10.4016H2.56066V11.9016H10.0607C12.4079 11.9016 14.3107 9.99885 14.3107 7.65164C14.3107 
+                                5.30443 12.4079 3.40164 10.0607 3.40164H3.37132L5.7123 1.06066L4.65164 0L1.03033 3.62131Z
+                                    </Path.Data>
+                                </Path>
+                            </Button>
+                            <!--重做-->
+                            <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoBtn_Click"
+                                    Background="Transparent">
+                                <Path IsEnabled="{Binding CanRedo,Mode=OneWay}">
+                                    <Path.Resources>
+                                        <Style TargetType="Path">
+                                            <Style.Triggers>
+                                                <Trigger Property="IsEnabled" Value="False">
+                                                    <Setter Property="Fill" Value="LightGray"/>
+                                                </Trigger>
+                                                <Trigger Property="IsEnabled" Value="True">
+                                                    <Setter Property="Fill" Value="#43474D"/>
+                                                </Trigger>
+                                            </Style.Triggers>
+                                        </Style>
+                                    </Path.Resources>
+                                    <Path.Data>
+                                        M13.7802 3.62131L14.3105 4.15164L13.7802 4.68197L10.1589 8.30328L9.09825 7.24261L11.4392 4.90164H4.74989C3.2311 4.90164 1.99989 6.13285 
+                                1.99989 7.65164C1.99989 9.17042 3.2311 10.4016 4.74989 10.4016H12.2499V11.9016H4.74989C2.40268 11.9016 0.499887 9.99885 0.499887 
+                                7.65164C0.499887 5.30443 2.40268 3.40164 4.74989 3.40164H11.4392L9.09825 1.06066L10.1589 0L13.7802 3.62131Z
+                                    </Path.Data>
+                                </Path>
+                            </Button>
+                        </StackPanel>
+
+                    </Grid>
+                </Border>
+
                 <!--工具栏展开-->
-                <Grid Name="ExpandToolContainer" Visibility="Collapsed">
+                <Grid Grid.Row="1"  Name="ExpandToolContainer" Visibility="Visible">
                     <Grid.RowDefinitions>
                         <RowDefinition Height="auto"></RowDefinition>
                         <RowDefinition Height="*"></RowDefinition>
@@ -251,7 +344,7 @@
                 </Grid>
 
                 <!--拖动调节控件大小-->
-                <GridSplitter Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+                <GridSplitter Name="Splitter"  Grid.Row="1"  Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
                     <GridSplitter.Template>
                         <ControlTemplate TargetType="{x:Type GridSplitter}">
                             <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
@@ -267,14 +360,12 @@
                     </GridSplitter.Template>
                 </GridSplitter>
 
-                <Grid Grid.Column="2" >
+                <Grid Grid.Row="1" Grid.Column="2" >
                     <Grid.RowDefinitions>
                         <RowDefinition Height="auto"/>
                         <RowDefinition Height="*"/>
                     </Grid.RowDefinitions>
 
-                    <Border x:Name="ToolBarContainer" Height="44" Visibility="Collapsed"></Border>
-
                     <Grid Grid.Row="1">
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition></ColumnDefinition>

+ 813 - 15
compdfkit_demo_windows/compdfkit/compdfkit/MainWindow.xaml.cs

@@ -1,10 +1,20 @@
 using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using compdfkit_tools.Data;
+using compdfkit_tools.Edit;
 using compdfkit_tools.Helper;
 using compdfkit_tools.PDFControl;
+using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
 using System.Linq;
+using System.Runtime.CompilerServices;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
@@ -16,22 +26,65 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Shapes;
+using Path = System.IO.Path;
 
 namespace compdfkit
 {
     /// <summary>
     /// MainWindow.xaml 的交互逻辑
     /// </summary>
-    public partial class MainWindow : Window
+    public partial class MainWindow : Window, INotifyPropertyChanged
     {
         private bool isFirstLoad = true;
         private string currentMode = "Viewer";
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl = new PDFViewControl();
         private CPDFAnnotationControl pdfAnnotationControl = null;
+        private UIElement pdfEditControl = null;
 
         private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
 
+        public bool CanSave
+        {
+            get
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                {
+                    return pdfViewControl.PDFView.UndoManager.CanSave;
+                }
+                return false;
+            }
+        }
+
+        public bool CanUndo
+        {
+            get
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                {
+                    return pdfViewControl.PDFView.UndoManager.CanUndo;
+                }
+                return false;
+            }
+        }
+
+        public bool CanRedo
+        {
+            get
+            {
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                {
+                    return pdfViewControl.PDFView.UndoManager.CanRedo;
+                }
+                return false;
+            }
+        }
+        /// <summary>
+        /// The last edit object
+        /// </summary>
+        private PDFEditEvent lastPDFEditEvent = null;
+        public event PropertyChangedEventHandler PropertyChanged;
+
         public MainWindow()
         {
             InitializeComponent();
@@ -41,6 +94,7 @@ namespace compdfkit
 
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
+            pdfAnnotationControl = new CPDFAnnotationControl();
             LoadDefaultDocument();
             BindZoomLevel();
         }
@@ -124,6 +178,12 @@ namespace compdfkit
             PDFGrid.Child = pdfViewControl;
             pdfViewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
             pdfViewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
+            pdfViewControl.PDFView.PDFEditCommandHandler -= PDFView_PDFEditCommandHandler; 
+            pdfViewControl.PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
+            pdfViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
+            pdfViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
+            pdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
+            pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged; 
             PasswordUI.Closed -= PasswordUI_Closed;
             PasswordUI.Canceled -= PasswordUI_Canceled;
             PasswordUI.Confirmed -= PasswordUI_Confirmed;
@@ -149,13 +209,495 @@ namespace compdfkit
                 ((CPDFBookmarkControl)currentBotaTool).InitWithPDFViewer(pdfViewControl.PDFView);
                 ((CPDFBookmarkControl)currentBotaTool).LoadBookmark();
             }
-
+            pdfAnnotationControl.SetPDFViewer(pdfViewControl.PDFView);
             ViewSettingBtn.IsChecked = false;
             PropertyContainer.Child = null;
             PropertyContainer.Visibility = Visibility.Collapsed;
             ZoomTextBox.Text = string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)) + "%";
         }
 
+        private void UndoManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+        {
+            OnPropertyChanged(e.PropertyName);
+        }
+
+        /// <summary>
+        /// 文字编辑右键菜单
+        /// </summary>
+        private void PDFEditTextContextMenu(object sender, PDFEditCommand editCommand)
+        {
+            editCommand.PopupMenu = new ContextMenu();
+            if (lastPDFEditEvent != null)
+            {
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                MenuItem propertyMenu = new MenuItem();
+                propertyMenu.Header = "Property";
+                propertyMenu.Click += (o, p) =>
+                {
+
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditText)
+                    {
+                        PDFTextEditControl textEditControl = new PDFTextEditControl();
+                        textEditControl.SetPDFTextEditData(lastPDFEditEvent);
+                        PropertyContainer.Child = textEditControl;
+                        PropertyContainer.Visibility = Visibility.Visible;
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(propertyMenu);
+            }
+            else
+            {
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                if (editCommand.TextAreaCopied)
+                {
+                    editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste And Match Style", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
+                }
+            }
+        }
+
+        /// <summary>
+        /// 图片编辑右键菜单
+        /// </summary>
+        private void PDFEditImageContextMenu(object sender, PDFEditCommand editCommand)
+        {
+            editCommand.PopupMenu = new ContextMenu();
+            if (lastPDFEditEvent != null)
+            {
+                MenuItem rotateLeftMenu = new MenuItem();
+                rotateLeftMenu.Header = "Left Rotate";
+                rotateLeftMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.Rotate = -90;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(rotateLeftMenu);
+
+                MenuItem rotateRightMenu = new MenuItem();
+                rotateRightMenu.Header = "Right Rotate";
+                rotateRightMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.Rotate = 90;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(rotateRightMenu);
+
+                MenuItem replaceMenu = new MenuItem();
+                replaceMenu.Header = "Replace";
+                replaceMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        OpenFileDialog openFileDialog = new OpenFileDialog();
+                        openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                        if (openFileDialog.ShowDialog() == true)
+                        {
+                            lastPDFEditEvent.ReplaceImagePath = openFileDialog.FileName;
+                            lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                            pdfViewControl.PDFView?.ClearSelectPDFEdit();
+                        }
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(replaceMenu);
+
+                MenuItem exportMenu = new MenuItem();
+                exportMenu.Header = "Export";
+                exportMenu.Click += (o, p) =>
+                {
+                    if (pdfViewControl != null && pdfViewControl.PDFView != null)
+                    {
+                        Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView.GetSelectedImages();
+                        if (imageDict != null && imageDict.Count > 0)
+                        {
+                            System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
+                            if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+                            {
+                                string choosePath = folderBrowser.SelectedPath;
+                                string openPath = choosePath;
+                                try
+                                {
+                                    foreach (int pageIndex in imageDict.Keys)
+                                    {
+                                        List<Bitmap> imageList = imageDict[pageIndex];
+                                        foreach (Bitmap image in imageList)
+                                        {
+                                            string savePath = System.IO.Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
+                                            image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                                            openPath = savePath;
+                                        }
+                                    }
+                                    Process.Start("explorer", "/select,\"" + openPath + "\"");
+                                }
+                                catch (Exception ex)
+                                {
+
+                                }
+                            }
+                        }
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(exportMenu);
+
+                MenuItem opacityMenu = new MenuItem();
+                opacityMenu.Header = "Opacity";
+                editCommand.PopupMenu.Items.Add(opacityMenu);
+
+                AppendOpacityMenu(opacityMenu);
+
+                MenuItem horizonMirror = new MenuItem();
+                horizonMirror.Header = "HMirror";
+                horizonMirror.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.HorizontalMirror = true;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(horizonMirror);
+
+                MenuItem verticalMirror = new MenuItem();
+                verticalMirror.Header = "VMirror";
+                verticalMirror.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.VerticalMirror = true;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(verticalMirror);
+
+                MenuItem cropMenu = new MenuItem();
+                cropMenu.Header = "Crop";
+                cropMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.ClipImage = true;
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                editCommand.PopupMenu.Items.Add(cropMenu);
+
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+            }
+            else
+            {
+                editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+            }
+        }
+
+        /// <summary>
+        /// 图片编辑透明度二级菜单
+        /// </summary>
+        private void AppendOpacityMenu(MenuItem parentMenu)
+        {
+            List<int> opacityList = new List<int>()
+            {
+                25,50,75,100
+            };
+
+            foreach (int opacity in opacityList)
+            {
+                MenuItem opacityMenu = new MenuItem();
+                opacityMenu.Header = string.Format("{0}%", opacity);
+                opacityMenu.Click += (o, p) =>
+                {
+                    if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+                    {
+                        lastPDFEditEvent.Transparency = (int)Math.Ceiling(opacity * 255 / 100D);
+                        lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                    }
+                };
+                parentMenu.Items.Add(opacityMenu);
+            }
+        }
+
+        private void PDFView_PDFEditCommandHandler(object sender, PDFEditCommand e)
+        {
+            if (e == null)
+            {
+                return;
+            }
+
+            if (e.EditType == CPDFEditType.EditText)
+            {
+                e.Handle = true;
+                PDFEditTextContextMenu(sender, e);
+            }
+
+            if (e.EditType == CPDFEditType.EditImage)
+            {
+                e.Handle = true;
+                PDFEditImageContextMenu(sender, e);
+            }
+        }
+
+        private void ExtraImage_Click(object sender, RoutedEventArgs e)
+        {
+            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
+            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                string choosePath = folderDialog.SelectedPath;
+                string openPath = choosePath;
+                try
+                {
+                    Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView?.GetSelectedImages();
+
+                    if (imageDict != null && imageDict.Count > 0)
+                    {
+                        foreach (int pageIndex in imageDict.Keys)
+                        {
+                            List<Bitmap> imageList = imageDict[pageIndex];
+                            foreach (Bitmap image in imageList)
+                            {
+                                string savePath = Path.Combine(choosePath, Guid.NewGuid() + ".jpg");
+                                image.Save(savePath, System.Drawing.Imaging.ImageFormat.Jpeg);
+                                openPath = savePath;
+                            }
+                        }
+                    }
+                    Process.Start("explorer", "/select,\"" + openPath + "\"");
+                }
+                catch (Exception ex)
+                {
+
+                }
+
+            }
+        }
+
+
+        private void CopyImage_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView?.GetSelectedImages();
+
+                if (imageDict != null && imageDict.Count > 0)
+                {
+                    foreach (int pageIndex in imageDict.Keys)
+                    {
+                        List<Bitmap> imageList = imageDict[pageIndex];
+                        foreach (Bitmap image in imageList)
+                        {
+                            MemoryStream ms = new MemoryStream();
+                            image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
+                            BitmapImage imageData = new BitmapImage();
+                            imageData.BeginInit();
+                            imageData.StreamSource = ms;
+                            imageData.CacheOption = BitmapCacheOption.OnLoad;
+                            imageData.EndInit();
+                            imageData.Freeze();
+                            Clipboard.SetImage(imageData);
+                            break;
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+
+        private void PDFView_AnnotCommandHandler(object sender, ComPDFKitViewer.AnnotEvent.AnnotCommandArgs e)
+        {
+            switch (e.CommandType)
+            {
+                case CommandType.Context:
+                    e.Handle = true;
+                    if (e.CommandTarget == TargetType.Annot)
+                    {
+                        e.Handle = true;
+                        e.PopupMenu = new ContextMenu();
+                        if (e.PressOnLink)
+                        {
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                            MenuItem propertyMenu = new MenuItem();
+                            propertyMenu = new MenuItem();
+                            propertyMenu.Header = "Edit";
+                            WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(propertyMenu, "Click", EditLink_Click);
+                            propertyMenu.CommandParameter = e;
+                            e.PopupMenu.Items.Add(propertyMenu);
+                        }
+                        else if (e.PressOnAnnot)
+                        {
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
+                        }
+                        else if (e.PressOnMedia || e.PressOnSound)
+                        {
+                            e.Handle = true;
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Play", Command = MediaCommands.Play, CommandTarget = (UIElement)sender, CommandParameter = e });
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
+                        }
+                        else if (e.PressOnSelectedText)
+                        {
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
+                        }
+                        else
+                        {
+                            e.Handle = true;
+                            e.PopupMenu = new ContextMenu();
+
+                            e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
+                            e.PopupMenu.Items.Add(new Separator());
+
+                            MenuItem fitWidthMenu = new MenuItem();
+                            fitWidthMenu.Header = "Fit Width";
+                            fitWidthMenu.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    pdfViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(fitWidthMenu);
+
+                            MenuItem fitSizeMenu = new MenuItem();
+                            fitSizeMenu.Header = "Actual Size";
+                            fitSizeMenu.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    pdfViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(fitSizeMenu);
+
+                            MenuItem zoomInMenu = new MenuItem();
+                            zoomInMenu.Header = "Zoom In";
+                            zoomInMenu.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                                    pdfViewControl.PDFView?.Zoom(newZoom);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(zoomInMenu);
+
+                            MenuItem zoomOutMenu = new MenuItem();
+                            zoomOutMenu.Header = "Zoom Out";
+                            zoomOutMenu.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                                    pdfViewControl.PDFView?.Zoom(newZoom);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(zoomOutMenu);
+                            e.PopupMenu.Items.Add(new Separator());
+
+                            MenuItem singleView = new MenuItem();
+                            singleView.Header = "Single Page";
+                            singleView.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    pdfViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(singleView);
+
+                            MenuItem singleContinuousView = new MenuItem();
+                            singleContinuousView.Header = "Single Page Continuous";
+                            singleContinuousView.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    pdfViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(singleContinuousView);
+
+                            MenuItem doubleView = new MenuItem();
+                            doubleView.Header = "Two Pages";
+                            doubleView.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    pdfViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(doubleView);
+
+                            MenuItem doubleContinuousView = new MenuItem();
+                            doubleContinuousView.Header = "Two Pages Continuous";
+                            doubleContinuousView.Click += (o, p) =>
+                            {
+                                if (pdfViewControl != null)
+                                {
+                                    pdfViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
+                                }
+                            };
+
+                            e.PopupMenu.Items.Add(doubleContinuousView);
+                        }
+                    }
+
+                    else if (e.CommandTarget == TargetType.ImageSelection)
+                    {
+                        if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.GetSelectImageCount() > 0)
+                        {
+                            e.Handle = true;
+                            e.PopupMenu = new ContextMenu();
+
+                            MenuItem imageCopyMenu = new MenuItem();
+                            imageCopyMenu = new MenuItem();
+                            imageCopyMenu.Header = "Copy Images";
+                            WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageCopyMenu, "Click", CopyImage_Click);
+                            imageCopyMenu.CommandParameter = e;
+                            e.PopupMenu.Items.Add(imageCopyMenu);
+
+                            MenuItem imageExtraMenu = new MenuItem();
+                            imageExtraMenu = new MenuItem();
+                            imageExtraMenu.Header = "Extract Images";
+                            WeakEventManager<MenuItem, RoutedEventArgs>.AddHandler(imageExtraMenu, "Click", ExtraImage_Click);
+                            imageExtraMenu.CommandParameter = e;
+                            e.PopupMenu.Items.Add(imageExtraMenu);
+                        }
+                    }
+                    break;
+                case CommandType.Copy:
+                    e.DoCommand();
+                    break;
+                case CommandType.Cut:
+                case CommandType.Paste:
+                case CommandType.Delete:
+                    e.DoCommand();
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        private void EditLink_Click(object sender, RoutedEventArgs e)
+        {
+            PropertyContainer.Visibility = Visibility.Visible;
+        }
+
         private void OpenFile_Click(object sender, RoutedEventArgs e)
         {
             try
@@ -200,7 +742,6 @@ namespace compdfkit
             }
         }
 
-
         private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
         {
             if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
@@ -431,7 +972,6 @@ namespace compdfkit
             }
             ExpandBotaTool(OutlineToolButton.IsChecked == true);
             ClearToolState(OutlineToolButton);
-
         }
 
         private void BookmarkToolButtonn_Click(object sender, RoutedEventArgs e)
@@ -488,6 +1028,10 @@ namespace compdfkit
             PropertyContainer.Width = 260;
             PropertyContainer.Child = properytPanel;
             PropertyContainer.Visibility = visible;
+            if (visible == Visibility.Hidden || visible == Visibility.Collapsed)
+            {
+                RightPanelButton.IsChecked = false;
+            }
         }
 
         private void RightPanelButton_Click(object sender, RoutedEventArgs e)
@@ -497,7 +1041,18 @@ namespace compdfkit
             {
                 if (toggleButton.IsChecked == true)
                 {
-                    ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
+                    if (currentMode == "Annotation")
+                    {
+                        ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
+                    }
+                    else if (currentMode == "Edit")
+                    {
+                        ExpandRightPropertyPanel(pdfEditControl, Visibility.Visible);
+                    }
+                    else
+                    {
+                        ExpandRightPropertyPanel(null, Visibility.Visible);
+                    }
                     if ((bool)ViewSettingBtn.IsChecked)
                     {
                         ViewSettingBtn.IsChecked = false;
@@ -510,50 +1065,293 @@ namespace compdfkit
             }
         }
 
+
+
         /// <summary>
-        /// 每一项退出时执行操作
-        /// 每一项进入时执行操作
+        /// Actions performed when switching modes:
+        /// Separated into actions performed upon entering and exiting the mode.
         /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
         private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             if (isFirstLoad)
             {
                 isFirstLoad = false;
-                return; 
+                return;
             }
 
             var item = (sender as ComboBox).SelectedItem as ComboBoxItem;
             switch (currentMode)
             {
                 case "Viewer":
-                    
+
                     break;
+                //Behavior when exit Edit mode
+                // Clear the ToolBar
+                // Collapse the ToolBar
+                // Clear And Collapse the property panel.
                 case "Annotation":
-                    ToolBarContainer.Visibility = Visibility.Collapsed;
+                    AnnotationBarControl.Visibility = Visibility.Collapsed;
+                    AnnotationBarControl.ClearAllToolState();
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+
                     break;
+
+                // Behavior when exit Edit mode:
+                // Collapsed the ToolBar
+                // Set the mode to allow editing None
+                // Set the mouse mode to PanTool
+                // Reload Document
+                // Unsubscribe click event.
+                // Clear And Collapse the property panel.
                 case "Edit":
-                    ToolBarContainer.Visibility = Visibility.Collapsed;
+                    PDFEditTool.Visibility = Visibility.Collapsed;
+                    pdfViewControl.PDFView?.SetShowLink(true);
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.None);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PanTool);
+                    pdfViewControl.PDFView?.ReloadDocument();
+
+                    pdfViewControl.PDFView.PDFEditActiveHandler -= PDFView_PDFEditActiveHandler;
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
                     break;
                 default:
                     break;
             }
 
+            // Behavior when switching to Viewer mode:
+            // Hide the ToolBar
             if ((string)item.Content == "Viewer")
             {
-                
+                ToolBarContainer.Visibility = Visibility.Collapsed;
             }
+
+            // Behavior when switching to Annotation mode:
+            // Show the ToolBar
+            // Show the AnnotationBar
             else if ((string)item.Content == "Annotation")
             {
                 ToolBarContainer.Visibility = Visibility.Visible;
+                AnnotationBarControl.Visibility = Visibility.Visible;
             }
+
+            // Behavior when switching to Edit mode:
+            // Show the ToolBar
+            // Show the EditBar
+            // Set the mode to allow editing of both text and images
+            // Set the mouse mode to PDFEdit
+            // Reload Document
             else if ((string)item.Content == "Edit")
             {
                 ToolBarContainer.Visibility = Visibility.Visible;
-            }
+                PDFEditTool.Visibility = Visibility.Visible;
+                pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
+                pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                pdfViewControl.PDFView?.ReloadDocument();
 
+                pdfViewControl.PDFView.PDFEditActiveHandler += PDFView_PDFEditActiveHandler;
+            }
             currentMode = (string)item.Content;
         }
+
+        #region Annotation Mode
+
+        private void AnnotationBarControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            CPDFAnnotationType[] annotationProperties = { CPDFAnnotationType.Highlight, CPDFAnnotationType.Underline, CPDFAnnotationType.Strikeout, CPDFAnnotationType.Squiggly, CPDFAnnotationType.Freehand, CPDFAnnotationType.FreeText, CPDFAnnotationType.Note, CPDFAnnotationType.Circle, CPDFAnnotationType.Square, CPDFAnnotationType.Arrow, CPDFAnnotationType.Line, CPDFAnnotationType.Stamp, CPDFAnnotationType.Signature, CPDFAnnotationType.Link, CPDFAnnotationType.Audio };
+            AnnotationBarControl.InitAnnotationBar(annotationProperties);
+            AnnotationBarControl.AnnotationPropertyChanged += AnnotationBarControl_AnnotationPropertyChanged;
+            AnnotationBarControl.AnnotationCancel += AnnotationBarControl_AnnotationCancel;
+        }
+
+        private void AnnotationBarControl_AnnotationCancel(object sender, EventArgs e)
+        {
+            ToggleButton toggleButton = sender as ToggleButton;
+            if (toggleButton != null)
+            {
+                if (toggleButton.IsChecked == true)
+                {
+                    if (pdfAnnotationControl != null)
+                    {
+                        ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
+                        if ((bool)ViewSettingBtn.IsChecked)
+                        {
+                            ViewSettingBtn.IsChecked = false;
+                        }
+                    }
+                }
+                else
+                {
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                }
+            }
+        }
+
+        private void AnnotationBarControl_AnnotationPropertyChanged(object sender, CPDFAnnotationType e)
+        {
+            pdfAnnotationControl.LoadAnnotationPanel(e);
+            if (e != CPDFAnnotationType.Audio)
+            {
+                ExpandRightPropertyPanel(pdfAnnotationControl, Visibility.Visible);
+                RightPanelButton.IsChecked = true;
+            }
+        }
+
+        private void AnnotationBarControl_Unloaded(object sender, RoutedEventArgs e)
+        {
+            AnnotationBarControl.AnnotationPropertyChanged -= AnnotationBarControl_AnnotationPropertyChanged;
+            AnnotationBarControl.AnnotationCancel -= AnnotationBarControl_AnnotationCancel;
+        }
+        #endregion
+
+        #region Edit Mode
+        /// <summary>
+        ///  Clear the selected state of editing-related buttons.
+        /// </summary>
+        private void ClearPDFEditState(ToggleButton ignoreBtn = null)
+        {
+            List<ToggleButton> clearBtnList = new List<ToggleButton>()
+            {
+                PDFTextEditButton,
+                PDFImageEditButton
+            };
+
+            foreach (ToggleButton item in clearBtnList)
+            {
+                if (ignoreBtn == item)
+                {
+                    continue;
+                }
+                item.IsChecked = false;
+            }
+        }
+
+        private void PDFTextEditButton_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton senderBtn = sender as ToggleButton;
+            if (senderBtn != null && pdfViewControl != null)
+            {
+                ClearPDFEditState(senderBtn);
+                if (senderBtn.IsChecked == true)
+                {
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PanTool);
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText);
+                    pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    pdfViewControl.PDFView?.ReloadDocument();
+                }
+                else
+                {
+                    pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage | CPDFEditType.EditText);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    pdfViewControl.PDFView?.ReloadDocument();
+                }
+            }
+        }
+
+        private void PDFImageEditButton_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton senderBtn = sender as ToggleButton;
+            if (senderBtn != null && pdfViewControl != null)
+            {
+                senderBtn.IsChecked = false;
+                OpenFileDialog openFileDialog = new OpenFileDialog();
+                openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
+                if (openFileDialog.ShowDialog() == true)
+                {
+                    ClearPDFEditState(senderBtn);
+                    pdfViewControl.PDFView?.ClearSelectPDFEdit();
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage | CPDFEditType.EditText);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    pdfViewControl.PDFView?.ReloadDocument();
+
+                    ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                    pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditImage);
+                    pdfViewControl.PDFView?.AddPDFEditImage(openFileDialog.FileName);
+                }
+            }
+        }
+
+        private void UndoBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null)
+            {
+                pdfViewControl.PDFView.UndoManager?.Undo();
+            }
+        }
+
+        private void RedoBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null)
+            {
+                pdfViewControl.PDFView.UndoManager?.Redo();
+            }
+        }
+
+        /// <summary>
+        /// Text and Image Selected Event
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void PDFView_PDFEditActiveHandler(object sender, ComPDFKitViewer.PDFEditEvent e)
+        {
+            lastPDFEditEvent = e;
+            ViewSettingBtn.IsChecked = false;
+            if (e == null)
+            {
+                pdfEditControl = null;
+                PropertyContainer.Child = pdfEditControl;
+                ExpandRightPropertyPanel(null, Visibility.Collapsed);
+                return;
+            }
+            if (Mouse.RightButton == MouseButtonState.Pressed)
+            {
+                return;
+            }
+            if (e.EditType == CPDFEditType.EditText)
+            {
+                PDFTextEditControl textEditControl = new PDFTextEditControl();
+                textEditControl.SetPDFTextEditData(e);
+                pdfEditControl = textEditControl as UIElement;
+                PropertyContainer.Child = pdfEditControl;
+                ExpandRightPropertyPanel(pdfEditControl, Visibility.Visible);
+                return;
+            }
+
+            if (e.EditType == CPDFEditType.EditImage && pdfViewControl != null)
+            {
+                UIElement pageView = sender as UIElement;
+                if (pageView != null)
+                {
+                    pageView.MouseLeftButtonUp += PageView_MouseLeftButtonUp; ;
+                }
+                return;
+            }
+        }
+
+        private void PageView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            UIElement pageView = sender as UIElement;
+            if (pageView != null)
+            {
+                pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
+            }
+            if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
+            {
+                PDFImageEditControl imageEditControl = new PDFImageEditControl();
+                imageEditControl.InitWithPDFViewer(pdfViewControl.PDFView);
+                imageEditControl.SetPDFImageEditData(lastPDFEditEvent);
+                pdfEditControl = imageEditControl as UIElement;
+                PropertyContainer.Child = pdfEditControl;
+                ExpandRightPropertyPanel(pdfEditControl, Visibility.Visible);
+            }
+        }
+        #endregion
+        /// <summary>
+        ///触发属性更改事件通知
+        /// </summary>
+        protected void OnPropertyChanged([CallerMemberName] string name = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+        }
     }
 }

+ 1 - 0
compdfkit_demo_windows/compdfkit/compdfkit/compdfkit.csproj

@@ -46,6 +46,7 @@
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Core" />

+ 1 - 3
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/MainWindow.xaml

@@ -380,9 +380,7 @@
 
                     </StackPanel>
 
-                    <Border Grid.Row="1" Name="BotaToolContainer">
-
-                    </Border>
+                    <Border Grid.Row="1" Name="BotaToolContainer"></Border>
                 </Grid>
 
                 <!--拖动调节控件大小-->

+ 44 - 21
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/MainWindow.xaml.cs

@@ -80,6 +80,10 @@ namespace edit_ctrl_demo
         private PDFViewControl passwordViewer;
         private PDFViewControl pdfViewControl;
 
+        private PDFImageEditControl imageEditControl = new PDFImageEditControl();
+
+        private PDFTextEditControl textEditControl = new PDFTextEditControl();
+
         private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
         public MainWindow()
         {
@@ -233,7 +237,7 @@ namespace edit_ctrl_demo
                     {
                         if (pdfViewControl != null)
                         {
-                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
                             pdfViewControl.PDFView?.Zoom(newZoom);
                         }
                     };
@@ -246,7 +250,7 @@ namespace edit_ctrl_demo
                     {
                         if (pdfViewControl != null)
                         {
-                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
                             pdfViewControl.PDFView?.Zoom(newZoom);
                         }
                     };
@@ -267,7 +271,7 @@ namespace edit_ctrl_demo
                     e.PopupMenu.Items.Add(singleView);
 
                     MenuItem singleContinuousView = new MenuItem();
-                    singleContinuousView.Header = "Single Continuous Page";
+                    singleContinuousView.Header = "Single Page Continuous";
                     singleContinuousView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -279,7 +283,7 @@ namespace edit_ctrl_demo
                     e.PopupMenu.Items.Add(singleContinuousView);
 
                     MenuItem doubleView = new MenuItem();
-                    doubleView.Header = "Double Page";
+                    doubleView.Header = "Two Pages";
                     doubleView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -291,7 +295,7 @@ namespace edit_ctrl_demo
                     e.PopupMenu.Items.Add(doubleView);
 
                     MenuItem doubleContinuousView = new MenuItem();
-                    doubleContinuousView.Header = "Double Continuous Page";
+                    doubleContinuousView.Header = "Two Pages Continuous";
                     doubleContinuousView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -304,7 +308,7 @@ namespace edit_ctrl_demo
                 }
             }
 
-            if(e!=null &&e.CommandType==CommandType.Copy)
+            if (e != null && e.CommandType == CommandType.Copy)
             {
                 e.DoCommand();
             }
@@ -326,7 +330,7 @@ namespace edit_ctrl_demo
                 }
                 else
                 {
-                    PasswordUI.SetShowError("error", Visibility.Visible);
+                    PasswordUI.SetShowError("Wrong Password", Visibility.Visible);
                 }
             }
         }
@@ -434,14 +438,17 @@ namespace edit_ctrl_demo
                 return;
             }
 
-            if (Mouse.RightButton == MouseButtonState.Pressed)
+            if (Mouse.RightButton == MouseButtonState.Pressed && PropertyContainer.Visibility!=Visibility.Visible)
             {
                 return;
             }
 
             if (e.EditType == CPDFEditType.EditText)
             {
-                PDFTextEditControl textEditControl = new PDFTextEditControl();
+                if (textEditControl == null)
+                {
+                    textEditControl = new PDFTextEditControl();
+                }
                 textEditControl.SetPDFTextEditData(e);
                 PropertyContainer.Child = textEditControl;
                 PropertyContainer.Visibility = Visibility.Visible;
@@ -453,9 +460,13 @@ namespace edit_ctrl_demo
                 UIElement pageView = sender as UIElement;
                 if (pageView != null)
                 {
+                    pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
                     pageView.MouseLeftButtonUp += PageView_MouseLeftButtonUp;
                 }
-
+                if(Mouse.RightButton == MouseButtonState.Pressed)
+                {
+                    SetImageEditProperty();
+                }
                 return;
             }
         }
@@ -467,9 +478,17 @@ namespace edit_ctrl_demo
             {
                 pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
             }
+            SetImageEditProperty();
+        }
+
+        private void SetImageEditProperty()
+        {
             if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
             {
-                PDFImageEditControl imageEditControl = new PDFImageEditControl();
+                if (imageEditControl == null)
+                {
+                    imageEditControl = new PDFImageEditControl();
+                }
                 imageEditControl.InitWithPDFViewer(pdfViewControl.PDFView);
                 imageEditControl.SetPDFImageEditData(lastPDFEditEvent);
                 PropertyContainer.Child = imageEditControl;
@@ -768,7 +787,6 @@ namespace edit_ctrl_demo
             {
 
             }
-
         }
 
         private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
@@ -837,7 +855,7 @@ namespace edit_ctrl_demo
             {
                 ClearPDFEditState(senderBtn);
                 senderBtn.IsChecked = false;
-               
+
                 OpenFileDialog openFileDialog = new OpenFileDialog();
                 openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
                 if (openFileDialog.ShowDialog() == true)
@@ -846,7 +864,7 @@ namespace edit_ctrl_demo
                     pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage | CPDFEditType.EditText);
                     pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
                     pdfViewControl.PDFView?.ReloadDocument();
-                   
+
                     PropertyContainer.Child = null;
                     PropertyContainer.Visibility = Visibility.Collapsed;
                     pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditImage);
@@ -901,7 +919,6 @@ namespace edit_ctrl_demo
         /// <summary>
         /// 文字编辑右键菜单
         /// </summary>
-
         private void PDFEditTextContextMenu(object sender, PDFEditCommand editCommand)
         {
             editCommand.PopupMenu = new ContextMenu();
@@ -942,28 +959,31 @@ namespace edit_ctrl_demo
         private void PDFEditImageContextMenu(object sender, PDFEditCommand editCommand)
         {
             editCommand.PopupMenu = new ContextMenu();
-            if (lastPDFEditEvent != null)
+
+            if(ApplicationCommands.Copy.CanExecute(null,(UIElement)sender) && lastPDFEditEvent!=null )
             {
                 MenuItem rotateLeftMenu = new MenuItem();
-                rotateLeftMenu.Header = "Left Rotate";
+                rotateLeftMenu.Header = "Rotate Left";
                 rotateLeftMenu.Click += (o, p) =>
                 {
                     if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
                     {
                         lastPDFEditEvent.Rotate = -90;
                         lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        imageEditControl?.SetImageThumb();
                     }
                 };
                 editCommand.PopupMenu.Items.Add(rotateLeftMenu);
 
                 MenuItem rotateRightMenu = new MenuItem();
-                rotateRightMenu.Header = "Right Rotate";
+                rotateRightMenu.Header = "Rotate Right";
                 rotateRightMenu.Click += (o, p) =>
                 {
                     if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
                     {
                         lastPDFEditEvent.Rotate = 90;
                         lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        imageEditControl?.SetImageThumb();
                     }
                 };
                 editCommand.PopupMenu.Items.Add(rotateRightMenu);
@@ -1031,25 +1051,27 @@ namespace edit_ctrl_demo
                 AppendOpacityMenu(opacityMenu);
 
                 MenuItem horizonMirror = new MenuItem();
-                horizonMirror.Header = "HMirror";
+                horizonMirror.Header = "Flip horizontal";
                 horizonMirror.Click += (o, p) =>
                 {
                     if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
                     {
                         lastPDFEditEvent.HorizontalMirror = true;
                         lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        imageEditControl?.SetImageThumb();
                     }
                 };
                 editCommand.PopupMenu.Items.Add(horizonMirror);
 
                 MenuItem verticalMirror = new MenuItem();
-                verticalMirror.Header = "VMirror";
+                verticalMirror.Header = "Flip vertical";
                 verticalMirror.Click += (o, p) =>
                 {
                     if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
                     {
                         lastPDFEditEvent.VerticalMirror = true;
                         lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        imageEditControl?.SetImageThumb();
                     }
                 };
                 editCommand.PopupMenu.Items.Add(verticalMirror);
@@ -1094,8 +1116,9 @@ namespace edit_ctrl_demo
                 {
                     if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditImage)
                     {
-                        lastPDFEditEvent.Transparency = (int)Math.Ceiling(opacity * 255 / 100D);
+                        lastPDFEditEvent.Transparency = (int)(opacity * 255 / 100D);
                         lastPDFEditEvent.UpdatePDFEditByEventArgs();
+                        imageEditControl?.SetImageTransparency(lastPDFEditEvent.Transparency);
                     }
                 };
                 parentMenu.Items.Add(opacityMenu);

+ 5 - 5
compdfkit_demo_windows/compdfkit/form-ctrl-demo/MainWindow.xaml.cs

@@ -185,7 +185,7 @@ namespace form_ctrl_demo
                     {
                         if (pdfViewControl != null)
                         {
-                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
                             pdfViewControl.PDFView?.Zoom(newZoom);
                         }
                     };
@@ -198,7 +198,7 @@ namespace form_ctrl_demo
                     {
                         if (pdfViewControl != null)
                         {
-                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
                             pdfViewControl.PDFView?.Zoom(newZoom);
                         }
                     };
@@ -219,7 +219,7 @@ namespace form_ctrl_demo
                     e.PopupMenu.Items.Add(singleView);
 
                     MenuItem singleContinuousView = new MenuItem();
-                    singleContinuousView.Header = "Single Continuous Page";
+                    singleContinuousView.Header = "Single Page Continuous";
                     singleContinuousView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -231,7 +231,7 @@ namespace form_ctrl_demo
                     e.PopupMenu.Items.Add(singleContinuousView);
 
                     MenuItem doubleView = new MenuItem();
-                    doubleView.Header = "Double Page";
+                    doubleView.Header = "Two Pages";
                     doubleView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -243,7 +243,7 @@ namespace form_ctrl_demo
                     e.PopupMenu.Items.Add(doubleView);
 
                     MenuItem doubleContinuousView = new MenuItem();
-                    doubleContinuousView.Header = "Double Continuous Page";
+                    doubleContinuousView.Header = "Two Pages Continuous";
                     doubleContinuousView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)

+ 1 - 1
compdfkit_demo_windows/compdfkit/viewer-ctrl-demo/MainWindow.xaml

@@ -346,7 +346,7 @@
                         <RowDefinition Height="*"></RowDefinition>
                     </Grid.RowDefinitions>
 
-                    <TextBlock Width="50" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">FileInfo:</TextBlock>
+                    <TextBlock Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">Document Info:</TextBlock>
                     <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="FileInfoCloseBtn_Click">
                         <Button.Content>
                             <Path Fill="Black">

+ 6 - 6
compdfkit_demo_windows/compdfkit/viewer-ctrl-demo/MainWindow.xaml.cs

@@ -163,7 +163,7 @@ namespace viewer_ctrl_demo
                     {
                         if (pdfViewControl != null)
                         {
-                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
                             pdfViewControl.PDFView?.Zoom(newZoom);
                         }
                     };
@@ -176,7 +176,7 @@ namespace viewer_ctrl_demo
                     {
                         if (pdfViewControl != null)
                         {
-                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                            double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
                             pdfViewControl.PDFView?.Zoom(newZoom);
                         }
                     };
@@ -197,7 +197,7 @@ namespace viewer_ctrl_demo
                     e.PopupMenu.Items.Add(singleView);
 
                     MenuItem singleContinuousView = new MenuItem();
-                    singleContinuousView.Header = "Single Continuous Page";
+                    singleContinuousView.Header = "Single Page Continuous";
                     singleContinuousView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -209,7 +209,7 @@ namespace viewer_ctrl_demo
                     e.PopupMenu.Items.Add(singleContinuousView);
 
                     MenuItem doubleView = new MenuItem();
-                    doubleView.Header = "Double Page";
+                    doubleView.Header = "Two Pages";
                     doubleView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -221,7 +221,7 @@ namespace viewer_ctrl_demo
                     e.PopupMenu.Items.Add(doubleView);
 
                     MenuItem doubleContinuousView = new MenuItem();
-                    doubleContinuousView.Header = "Double Continuous Page";
+                    doubleContinuousView.Header = "Two Pages Continuous";
                     doubleContinuousView.Click += (o, p) =>
                     {
                         if (pdfViewControl != null)
@@ -255,7 +255,7 @@ namespace viewer_ctrl_demo
                 }
                 else
                 {
-                    PasswordUI.SetShowError("error", Visibility.Visible);
+                    PasswordUI.SetShowError("Wrong Password", Visibility.Visible);
                 }
             }
         }