Browse Source

PDFEdit(Windows) - 补充文字编辑高保真效果

liyuxuan 1 year ago
parent
commit
798367e26c

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

@@ -36,7 +36,7 @@
 
             <TextBlock Margin="0,20,0,0" Foreground="#0E1114" FontSize="14">Text Color:</TextBlock>
 
-            <common:ColorPickerControl x:Name="FontColorUI" Grid.Row="1" Margin="0,20,0,0"></common:ColorPickerControl>
+            <common:ColorPickerControl x:Name="FontColorUI" Grid.Row="1" Margin="0,20,0,0" TransparentBtnProperty="Collapsed"></common:ColorPickerControl>
 
             <Grid Grid.Row="2" Margin="0,20,0,0" Visibility="Visible">
                 <Grid.ColumnDefinitions>

+ 2 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Edit/PDFTextEdit/PDFTextEditUI/CPDFTextAlignUI.xaml

@@ -31,7 +31,8 @@
                 </ToggleButton.Content>
             </ToggleButton>
 
-            <ToggleButton Name="AlignCenterBtn" Width="30" Margin="10,0,0,0" BorderThickness="0" Padding="0,5,0,5" Tag="AlignCenter" Style="{StaticResource ToggleButtonStyle}" Click="TextAlignBtn_Click">
+            <ToggleButton Name="AlignCenterBtn" Width="30" Margin="10,0,0,0" BorderThickness="0" Padding="0,5,0,5" Tag="AlignCenter" Style="{StaticResource ToggleButtonStyle}" Click="TextAlignBtn_Click"
+                          >
                 <ToggleButton.Content>
                     <Path Name="AlignCenterPath" Fill="Gray">
                         <Path.Data>

+ 409 - 72
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/MainWindow.xaml

@@ -4,8 +4,7 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:edit_ctrl_demo"
-        xmlns:pdfview="clr-namespace:ComPDFKitViewer.PdfViewer;assembly=ComPDFKit.Viewer"
-        xmlns:tools="clr-namespace:compdfkit_tools.PDFControl;assembly=com.compdfkit.tools"
+        xmlns:cpdftools="clr-namespace:compdfkit_tools.PDFControl;assembly=com.compdfkit.tools"
         mc:Ignorable="d"
         Title="MainWindow" Height="700" Width="1200" WindowStartupLocation="CenterScreen">
     <Window.Resources>
@@ -17,99 +16,437 @@
         </ResourceDictionary>
     </Window.Resources>
     <Grid>
-        <Grid.RowDefinitions>
-            <RowDefinition Height="auto"></RowDefinition>
-            <RowDefinition Height="*"></RowDefinition>
-            <RowDefinition Height="auto"></RowDefinition>
-        </Grid.RowDefinitions>
-
-        <!--顶部菜单部分-->
         <Grid>
             <Grid.RowDefinitions>
-                <RowDefinition Height="auto"></RowDefinition>
-                <RowDefinition Height="auto"></RowDefinition>
-                <RowDefinition Height="auto"></RowDefinition>
+                <RowDefinition Height="40"></RowDefinition>
+                <RowDefinition Height="*"></RowDefinition>
             </Grid.RowDefinitions>
-            <tools:TitleBarControl Name="TitleBarTool"></tools:TitleBarControl>
-            
-            <ToggleButton Name="PDFEditBtn" Grid.Row="1" HorizontalAlignment="Center" Padding="10,3,10,3" BorderThickness="0" Click="PDFEditBtn_Click">
-                <TextBlock  FontSize="14" VerticalAlignment="Center">PDFEdit</TextBlock>
-            </ToggleButton>
-
-            <Grid Grid.Row="2" Background="#F2F3F5">
-                <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">
+
+            <!--顶部工具栏-->
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+
+                <!--左侧工具栏-->
+                <StackPanel Orientation="Horizontal" Height="40" Margin="20,0,0,0">
+
+                    <!--打开文件-->
+                    <Button BorderThickness="0" VerticalContentAlignment="Center" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="OpenFile_Click">
+                        <Button.Content>
+                            <Viewbox Width="20" Height="20">
+                                <Path Fill="#43474D" >
+                                    <Path.Data>
+                                        M3.75,2 L3.91967773,2.00463867 C4.08325195,2.01391602 4.22851562,2.03710938 4.35546875,2.07421875 C4.52473958,2.12369792 
+                                    4.67578125,2.18489583 4.80859375,2.2578125 C4.94140625,2.33072917 5.05989583,2.41145833 5.1640625,2.5 C5.26822917,2.58854167 
+                                    5.37369792,2.66927083 5.48046875,2.7421875 C5.58723958,2.81510417 5.70182292,2.87630208 5.82421875,2.92578125 C5.94661458,2.97526042 
+                                    6.08854167,3 6.25,3 L6.25,3 L12,3 L12.1371528,3.00868056 C12.2262731,3.02025463 12.3107639,3.04340278 12.390625,3.078125 
+                                    C12.5104167,3.13020833 12.6158854,3.20182292 12.7070312,3.29296875 C12.7981771,3.38411458 12.8697917,3.48958333 12.921875,3.609375 
+                                    C12.9739583,3.72916667 13,3.859375 13,4 L13,4 L13,6 L15,6 L15.1332465,6.00868056 C15.2206308,6.02025463 15.3051215,6.04340278 
+                                    15.3867188,6.078125 C15.5091146,6.13020833 15.6158854,6.20182292 15.7070312,6.29296875 C15.7981771,6.38411458 15.8697917,6.48958333 
+                                    15.921875,6.609375 C15.9739583,6.72916667 16,6.85677083 16,6.9921875 C16,7.1484375 15.9635417,7.29947917 15.890625,7.4453125 
+                                    L15.890625,7.4453125 L12.6171875,14 L0,14 L0,3 L0.00868055556,2.86284722 C0.0202546296,2.77372685 0.0434027778,2.68923611 0.078125,2.609375 
+                                    C0.130208333,2.48958333 0.201822917,2.38411458 0.29296875,2.29296875 C0.384114583,2.20182292 0.489583333,2.13020833 0.609375,2.078125 
+                                    C0.729166667,2.02604167 0.859375,2 1,2 L1,2 L3.75,2 Z M15,7 L4.3125,7 L1.3125,13 L12,13 L15,7 Z M3.75,3 L1,3 L1,11.3828125 L3.4140625,6.5546875 
+                                    L3.48706055,6.43261719 C3.56665039,6.31738281 3.66601562,6.22265625 3.78515625,6.1484375 C3.94401042,6.04947917 4.11979167,6 4.3125,6 
+                                    L4.3125,6 L12,6 L12,4 L6.25,4 L6.08032227,3.99536133 C5.91674805,3.98608398 5.77148438,3.96289062 5.64453125,3.92578125 C5.47526042,3.87630208 
+                                    5.32421875,3.81510417 5.19140625,3.7421875 C5.05859375,3.66927083 4.94010417,3.58854167 4.8359375,3.5 C4.73177083,3.41145833 4.62630208,3.33072917 
+                                    4.51953125,3.2578125 C4.41276042,3.18489583 4.29817708,3.12369792 4.17578125,3.07421875 C4.05338542,3.02473958 3.91145833,3 3.75,3 L3.75,3 Z
+                                    </Path.Data>
+                                </Path>
+                            </Viewbox>
+                        </Button.Content>
+                    </Button>
+
+                    <!--保存文件-->
+                    <Button BorderThickness="0" VerticalContentAlignment="Center" Margin="10,0,0,0" Width="30" Height="30" Style="{StaticResource LightButtonStyle}" Background="Transparent" 
+                            Click="SaveFileBtn_Click">
+                        <Button.Content>
+                            <Viewbox Width="20" Height="20">
+                                <Path Fill="#43474D" >
+                                    <Path.Data>
+                                        M11.707107,1 L15,4.29289322 L15,15 L1,15 L1,1 L11.707107,1 Z M11.293,2 L2,2 L2,14 L4,14 L4,8 L12,8 L12,14 L14,14 L14,4.707 L11.293,2 Z 
+                                        M11,9 L5,9 L5,14 L11,14 L11,9 Z M7,5 L7,6 L4,6 L4,5 L7,5 Z
+                                    </Path.Data>
+                                </Path>
+                            </Viewbox>
+                        </Button.Content>
+                    </Button>
+
+                    <!--工具栏展开收缩-->
+                    <ToggleButton Margin="13,0,0,0" BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ToolExpand_Click">
+                        <ToggleButton.Content>
+                            <Path Fill="#43474D" Width="30" Height="30">
                                 <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
+                                    M22.5 8.5H7.5V12.25H13H22.5V8.5ZM12.25 13.75H7.5V21.5H12.25V13.75ZM13.75 21.5V13.75H22.5V21.5H13.75ZM7.5 7H6V8.5V21.5V23H7.5H22.5H24V21.5V8.5V7H22.5H7.5Z
                                 </Path.Data>
                             </Path>
-                            <TextBlock  FontSize="12" VerticalAlignment="Center" Margin="8,0,0,0">Add Text</TextBlock>
-                        </StackPanel>
+                        </ToggleButton.Content>
                     </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">
+                    <Line Margin="13,0,13,0" Stroke="#E0E0E0" X1="0" Y1="5" X2="0" Y2="35"></Line>
+
+                    <!--抓手工具-->
+                    <ToggleButton BorderThickness="0" Width="30" Height="30" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" IsChecked="True" IsEnabled="False" Visibility="Collapsed">
+                        <ToggleButton.Content>
+                            <Path Fill="#43474D">
                                 <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
+                                    M8.7463 7.94055L8.43134 3.20358C8.38986 2.6073 8.82031 2.08322 9.40947 2.01273L9.46546 2.00656C9.75502 1.97416 10.0451 2.06271 10.2681 2.25159C10.4911 
+                                2.44047 10.6276 2.71317 10.6457 3.00614L10.9886 8.17061C10.999 8.31659 11.1097 8.43516 11.2537 8.45444C11.3176 8.46288 11.382 8.44409 11.4315 
+                                8.40258C11.481 8.36108 11.5111 8.30063 11.5145 8.23584L11.7612 3.47595C11.7918 2.85998 12.3116 2.38523 12.923 2.41468H12.9309C13.5429 2.44972 
+                                14.0111 2.97745 13.9773 3.59407L13.7218 8.51438C13.7137 8.66679 13.8235 8.79975 13.9738 8.81936C14.1225 8.83876 14.2625 8.73915 14.2914 
+                                8.59018L14.8006 6.02337C14.9178 5.41517 15.497 5.01851 16.0954 5.13574L16.1041 5.13751C16.7058 5.25854 17.0969 5.84695 16.979 6.45353L16.3684 
+                                9.53687C15.8189 13.3474 15.0586 15.5052 14.3946 16.4246C13.3649 17.8508 11.5573 17.8667 10.1251 17.8667C8.69381 17.8667 7.16012 17.5291 6.44796 
+                                16.9993C5.73492 16.4696 4.77079 15.2575 4.15837 13.9327L4.16712 13.9283C4.11876 13.8639 4.0774 13.7945 4.04376 13.7212L3.105 11.685C2.84552 11.1243 
+                                3.08338 10.4577 3.63781 10.1918L3.64656 10.1874C3.91235 10.0626 4.21656 10.0497 4.49179 10.1517C4.76702 10.2536 4.99055 10.4619 5.11287 10.7304C5.62206 
+                                11.8234 5.94227 12.324 6.07526 12.2324C6.27386 12.0949 6.12075 11.7176 5.85478 9.21249C5.67578 7.53039 5.45319 5.85328 5.18724 4.18289C5.07653 3.5968 
+                                5.44002 3.02581 6.01489 2.88273L6.07526 2.86775C6.35866 2.79957 6.65742 2.85178 6.90147 3.01215C7.14552 3.17252 7.3134 3.42693 7.36572 3.71571L8.168 
+                                8.02341C8.19642 8.17613 8.33897 8.27937 8.49171 8.25787C8.64561 8.23564 8.75656 8.09774 8.7463 7.94143V7.94055Z
                                 </Path.Data>
                             </Path>
-                            <TextBlock  FontSize="12" VerticalAlignment="Center" Margin="8,0,0,0">Add Picture</TextBlock>
-                        </StackPanel>
+                        </ToggleButton.Content>
                     </ToggleButton>
 
-                    <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+                    <Line Margin="13,0,13,0" Stroke="#E0E0E0" X1="0" Y1="5" X2="0" Y2="35" Visibility="Collapsed"></Line>
 
-                    <!--撤销-->
-                    <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}" Click="UndoBtn_Click">
-                        <Path Fill="#43474D">
+                    <Grid>
+                        <ComboBox Name="ZoomComboBox" VerticalContentAlignment="Center" Width="72" Height="30" Foreground="#43474D" FontSize="14"
+                              SelectionChanged="ZoomComboBox_SelectionChanged" BorderBrush="#1E000000">
+                        </ComboBox>
+                        <TextBox Name="ZoomTextBox" IsHitTestVisible="False" Width="72" Height="30" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
+                             IsReadOnly="True" Background="White" Padding="0,0,15,0">100%</TextBox>
+                        <Path Fill="#43474D" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,5,0" IsHitTestVisible="False">
                             <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
+                                M0.5 0.510248L4.5041 5.5L8.5 0.5L0.5 0.510248Z
                             </Path.Data>
                         </Path>
+                    </Grid>
+
+                    <Button Margin="20,0,0,0" Width="30" Height="30" BorderThickness="0" Background="Transparent" Style="{StaticResource LightButtonStyle}" Click="ZoomOutBtn_Click" >
+                        <Button.Content>
+                            <Rectangle Width="12" Height="2" Fill="#0E1114"></Rectangle>
+                        </Button.Content>
                     </Button>
-                    <!--重做-->
-                    <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0" Width="40" Height="40" Margin="10,0,0,0"  IsEnabled="{Binding CanRedo,Mode=OneWay}" Click="RedoBtn_Click">
-                        <Path Fill="#43474D">
-                            <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 Margin="10,0,0,0" Width="30" Height="30" BorderThickness="0" Background="Transparent" Style="{StaticResource LightButtonStyle}" Click="ZoomInBtn_Click">
+                        <Button.Content>
+                            <Path Fill="#0E1114">
+                                <Path.Data>
+                                    M7.625 6.375V0.75H6.375V6.375H0.75V7.625H6.375V13.25H7.625V7.625H13.25V6.375H7.625Z
+                                </Path.Data>
+                            </Path>
+                        </Button.Content>
                     </Button>
+
                 </StackPanel>
+
+                <!--中间工具栏-->
+                <ComboBox Name="ViewComboBox" Width="120" Height="26" Grid.Column="1" HorizontalAlignment="Center" FontSize="14" Foreground="#001A4E" SelectionChanged="ComboBox_SelectionChanged">
+                    <ComboBoxItem>Viewer</ComboBoxItem>
+                    <ComboBoxItem IsSelected="True">PDF Edit</ComboBoxItem>
+                </ComboBox>
+
+                <!--右侧工具栏-->
+                <StackPanel Orientation="Horizontal" Grid.Column="2">
+
+                    <!--搜索按钮-->
+                    <Button BorderThickness="0" Width="40" Height="40" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="ExpandSearchBtn_Click">
+                        <Button.Content>
+                            <Path Fill="#43474D">
+                                <Path.Data>
+                                    M5.10992 13.9353C2.71184 11.5372 2.71184 7.64917 5.10992 5.25108C7.50801 2.853 11.3961 2.853 13.7942 5.25108C16.1922 7.64917 
+                                16.1922 11.5372 13.7942 13.9353C11.3961 16.3334 7.50801 16.3334 5.10992 13.9353ZM4.04926 4.19042C1.06539 7.17429 1.06539 12.0121 
+                                4.04926 14.996C6.85422 17.8009 11.2975 17.9691 14.2989 15.5005L17.1989 18.4006C17.4918 18.6935 17.9667 18.6935 18.2596 
+                                18.4006C18.5525 18.1077 18.5525 17.6328 18.2596 17.3399L15.3595 14.4399C17.828 11.4384 17.6597 6.99533 14.8548 
+                                4.19042C11.8709 1.20655 7.03313 1.20655 4.04926 4.19042Z
+                                </Path.Data>
+                            </Path>
+                        </Button.Content>
+                    </Button>
+
+                    <!--右侧工具栏展开收缩-->
+                    <ToggleButton BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Visibility="Collapsed">
+                        <ToggleButton.Content>
+                            <Path Fill="#43474D" Width="30" Height="30">
+                                <Path.Data>
+                                    M22.5 8.5H7.5V12.25H13H22.5V8.5ZM12.25 13.75H7.5V21.5H12.25V13.75ZM13.75 21.5V13.75H22.5V21.5H13.75ZM7.5 7H6V8.5V21.5V23H7.5H22.5H24V21.5V8.5V7H22.5H7.5Z
+                                </Path.Data>
+                            </Path>
+                        </ToggleButton.Content>
+                    </ToggleButton>
+                    
+                    <!--页面显示-->
+                    <ToggleButton BorderThickness="0" Width="40" Height="40" Style="{StaticResource ToggleButtonStyle}" Background="Transparent" Click="ViewSettingBtn_Click">
+                        <ToggleButton.Content>
+                            <Path Stroke="#43474D" VerticalAlignment="Center" StrokeThickness="2">
+                                <Path.Data>
+                                    <CombinedGeometry GeometryCombineMode="Exclude">
+                                        <CombinedGeometry.Geometry1>
+                                            M18.3327 10C18.3327 10 14.6017 16.25 9.99935 16.25C5.39698 16.25 1.66602 10 1.66602 10C1.66602 10 5.39698 3.75 9.99935 3.75C14.6017 3.75 18.3327 10 18.3327 10Z
+                                        </CombinedGeometry.Geometry1>
+                                        <CombinedGeometry.Geometry2>
+                                            <EllipseGeometry Center="10,10" RadiusX="2" RadiusY="2"/>
+                                        </CombinedGeometry.Geometry2>
+                                    </CombinedGeometry>
+                                </Path.Data>
+                            </Path>
+                        </ToggleButton.Content>
+                    </ToggleButton>
+
+                    <!--页面信息-->
+                    <Button BorderThickness="0" Width="40" Height="40" Style="{StaticResource LightButtonStyle}" Background="Transparent" Click="PageInfoBtn_Click">
+                        <Button.Content>
+                            <Path Fill="#43474D" VerticalAlignment="Center">
+                                <Path.Data>
+                                    M2.75 10C2.75 5.99594 5.99594 2.75 10 2.75C14.0041 2.75 17.25 5.99594 17.25 10C17.25 14.0041 14.0041 17.25 10 
+                                17.25C5.99594 17.25 2.75 14.0041 2.75 10ZM10 1.25C5.16751 1.25 1.25 5.16751 1.25 10C1.25 14.8325 5.16751 
+                                18.75 10 18.75C14.8325 18.75 18.75 14.8325 18.75 10C18.75 5.16751 14.8325 1.25 10 1.25ZM6.5 11C7.05228 11 
+                                7.5 10.5523 7.5 10C7.5 9.44771 7.05228 9 6.5 9C5.94772 9 5.5 9.44771 5.5 10C5.5 10.5523 5.94772 11 6.5 11ZM10 
+                                11C10.5523 11 11 10.5523 11 10C11 9.44771 10.5523 9 10 9C9.44771 9 9 9.44771 9 10C9 10.5523 9.44771 11 10 11ZM14.5 
+                                10C14.5 10.5523 14.0523 11 13.5 11C12.9477 11 12.5 10.5523 12.5 10C12.5 9.44771 12.9477 9 13.5 9C14.0523 9 14.5 9.44771 14.5 10Z
+                                </Path.Data>
+                            </Path>
+                        </Button.Content>
+                    </Button>
+                </StackPanel>
+
             </Grid>
-            
-        </Grid>
 
-        <!--中间内容部分-->
-        <Grid Grid.Row="1">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="*"></ColumnDefinition>
-                <ColumnDefinition Width="auto"></ColumnDefinition>
-            </Grid.ColumnDefinitions>
-
-            <pdfview:CPDFViewer Name="PDFView"></pdfview:CPDFViewer>
-            
-            <!--右侧属性面板-->
-            <Border Name="PDFEditContainer" Grid.Column="1">
-                
-            </Border>
-        </Grid>
+            <Grid Name="BodyGrid" Grid.Row="1">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="0"></ColumnDefinition>
+                    <ColumnDefinition Width="0"></ColumnDefinition>
+                    <ColumnDefinition Width="*"></ColumnDefinition>
+                    <ColumnDefinition Width="auto"></ColumnDefinition>
+                </Grid.ColumnDefinitions>
+
+                <!--工具栏展开-->
+                <Grid Name="ExpandToolContainer" Visibility="Collapsed">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="*"></RowDefinition>
+                    </Grid.RowDefinitions>
+
+                    <StackPanel Name="BotaSideTool" Background="{StaticResource color.bg.jumpbar}" Orientation="Horizontal">
+
+                        <!--缩略图-->
+                        <ToggleButton Name="ThumbToolButton"  Height="40" Width="65" BorderThickness="0"  Style="{StaticResource ToggleButtonStyle}" Click="ThumbToolButton_Click" >
+                            <ToggleButton.Content>
+                                <Path Width="20" Height="20" Fill="#273C62">
+                                    <Path.Data>
+                                        M3.25 1H2.5V1.75V14.25V15H3.25H13.749H14.499V14.25V8V5.65625V5.36131L14.2981 5.14538L10.6638 1.23913L10.4413 1H10.1147H8.49949H3.25ZM4 
+                                    13.5V2.5H8.49949H8.75V6V6.75H9.5H12.999V8V13.5H4ZM12.3466 5.25L10.25 2.99648V5.25H12.3466Z
+                                    </Path.Data>
+                                </Path>
+                            </ToggleButton.Content>
+                        </ToggleButton>
+
+                        <!--大纲-->
+                        <ToggleButton  Name="OutlineToolButton"  Height="40" Width="65" BorderThickness="0"  Style="{StaticResource ToggleButtonStyle}" Click="OutlineToolButton_Click">
+                            <ToggleButton.Content>
+                                <Path Width="20" Height="20" Fill="#001A4E">
+                                    <Path.Data>
+                                        M4.5 1.5H1.5V4.5H4.5V1.5ZM4.5 6.5H1.5V9.5H4.5V6.5ZM1.5 11.5H4.5V14.5H1.5V11.5ZM15.5 3.75V2.25H6.5V3.75H15.5ZM15.5 7.25V8.75H6.5V7.25H15.5ZM15.5 13.75V12.25H6.5V13.75H15.5Z
+                                    </Path.Data>
+                                </Path>
+                            </ToggleButton.Content>
+                        </ToggleButton>
+
+                        <!--书签-->
+                        <ToggleButton Name="BookmarkToolButton" Height="40" Width="65" BorderThickness="0"  Style="{StaticResource ToggleButtonStyle}" Click="BookmarkToolButtonn_Click">
+                            <ToggleButton.Content>
+                                <Path Width="20" Height="20" Stroke="#001A4E">
+                                    <Path.Data>
+                                        M6.1221 9.85217L1.25 12.6942V0.75H11.75V12.6942L6.8779 9.85217L6.5 9.63172L6.1221 9.85217Z
+                                    </Path.Data>
+                                </Path>
+                            </ToggleButton.Content>
+                        </ToggleButton>
+
+                        <!--文字搜索-->
+                        <ToggleButton Name="SearchToolButton" Height="40" Width="65" BorderThickness="0"  Style="{StaticResource ToggleButtonStyle}" Click="SearchToolButton_Click">
+                            <ToggleButton.Content>
+                                <Path Width="20" Height="20" Fill="#001A4E">
+                                    <Path.Data>
+                                        M4.9284 11.1635C3.06851 9.30364 3.06851 6.28816 4.9284 4.42827C6.78829 2.56838 9.80377 2.56838 11.6637 4.42827C13.5235 6.28816 13.5235 9.30364 11.6637 11.1635C9.80377 
+                                    13.0234 6.78829 13.0234 4.9284 11.1635ZM3.86774 3.36761C1.42207 5.81329 1.42207 9.77851 3.86774 12.2242C6.13397 14.4904 9.70494 14.6567 12.1626 12.723L14.3875 
+                                    14.9479C14.6804 15.2408 15.1552 15.2408 15.4481 14.9479C15.741 14.655 15.741 14.1801 15.4481 13.8872L13.2233 11.6624C15.1568 9.20466 14.9905 5.63379 12.7243 
+                                    3.36761C10.2786 0.921935 6.31342 0.921935 3.86774 3.36761Z
+                                    </Path.Data>
+                                </Path>
+                            </ToggleButton.Content>
+                        </ToggleButton>
+
+                    </StackPanel>
 
-        <!--底部工具部分-->
-        <Grid Grid.Row="2">
-            
+                    <Border Grid.Row="1" Name="BotaToolContainer">
+
+                    </Border>
+                </Grid>
+
+                <!--拖动调节控件大小-->
+                <GridSplitter Name="Splitter" Grid.Column="1" Width="15" ResizeBehavior="PreviousAndNext" Visibility="Collapsed">
+                    <GridSplitter.Template>
+                        <ControlTemplate TargetType="{x:Type GridSplitter}">
+                            <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
+                        BorderBrush="{TemplateBinding Border.BorderBrush}"
+                        Background="{TemplateBinding Panel.Background}" >
+                                <Path Fill="Gray" VerticalAlignment="Center">
+                                    <Path.Data>
+                                        M15 3.75H1V2.25H15V3.75ZM15 8.75H1V7.25H15V8.75ZM1 13.75H15V12.25H1V13.75Z
+                                    </Path.Data>
+                                </Path>
+                            </Border>
+                        </ControlTemplate>
+                    </GridSplitter.Template>
+                </GridSplitter>
+
+                <Grid Grid.Column="2" >
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="*"></RowDefinition>
+                    </Grid.RowDefinitions>
+
+                    <Border Background="#F2F3F5">
+                        <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.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 Picture</TextBlock>
+                                </StackPanel>
+                            </ToggleButton>
+
+                            <Line Height="40" Stroke="#D5D6D8" StrokeThickness="2" X1="0" Y1="10" X2="0" Y2="30" Margin="8,0,8,0" />
+
+                            <!--撤销-->
+                            <Button Style="{StaticResource LightButtonStyle}" BorderThickness="0"  Width="40" Height="40" IsEnabled="{Binding CanUndo,Mode=OneWay}" Click="UndoBtn_Click"
+                                    Background="Transparent">
+                                <Path Fill="#43474D">
+                                    <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 Fill="#43474D">
+                                    <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>
+
+                    <!--PDFViewer-->
+                    <Border Grid.Row="1" x:Name="PDFGrid" Background="{StaticResource color.bg.mainpage}" MouseMove="PDFGrid_MouseMove"></Border>
+
+                    <Border Grid.Row="1" Background="Transparent" VerticalAlignment="Bottom" HorizontalAlignment="Center" CornerRadius="5" Width="100" Height="36" Margin="0,0,0,30"
+                        MouseEnter="Border_MouseEnter"  />
+                    <!--页码工具-->
+                    <Border Grid.Row="1" Name="FloatPageTool" Background="#CC000000" VerticalAlignment="Bottom" HorizontalAlignment="Center"
+                        Margin="0,0,0,20" CornerRadius="5" Width="100" Height="36" Visibility="Collapsed">
+                        <Grid>
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="auto"></ColumnDefinition>
+                                <ColumnDefinition Width="*"></ColumnDefinition>
+                                <ColumnDefinition Width="auto"></ColumnDefinition>
+                            </Grid.ColumnDefinitions>
+
+                            <!--上一页-->
+                            <Border Background="Transparent" Width="20" Height="20" Margin="11,0,0,0" MouseLeftButtonDown="PrevPageBorder_MouseLeftButtonDown">
+                                <Path Fill="White" VerticalAlignment="Center" HorizontalAlignment="Center">
+                                    <Path.Data>
+                                        M7.70711 13.7071C8.06759 13.3466 8.09532 12.7794 7.7903 12.3871L7.70711 12.2929L2.415 7L7.70711 1.70711C8.06759 1.34662 
+                                        8.09532 0.779392 7.7903 0.387101L7.70711 0.292894C7.34662 -0.0675898 6.77939 -0.0953197 6.3871 0.209705L6.29289 
+                                        0.292894L0.292892 6.29289C-0.0675917 6.65338 -0.0953217 7.22061 0.209703 7.6129L0.292892 7.70711L6.29289 
+                                        13.7071C6.68342 14.0976 7.31658 14.0976 7.70711 13.7071Z
+                                    </Path.Data>
+                                </Path>
+                            </Border>
+
+                            <!--页码范围-->
+                            <TextBlock Name="PageRangeText" Grid.Column="1" Foreground="White" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Center">2/3</TextBlock>
+
+                            <!--下一页-->
+                            <Border Width="20" Height="20" Background="Transparent" Grid.Column="2" Margin="0,0,11,0" MouseLeftButtonDown="NextPageBorder_MouseLeftButtonDown">
+                                <Path Fill="White" VerticalAlignment="Center" HorizontalAlignment="Center">
+                                    <Path.Data>
+                                        M0.292893 0.292893C-0.0675908 0.653377 -0.0953203 1.22061 0.209705 1.6129L0.292893 1.70711L5.585 7L0.292893 
+                                    12.2929C-0.0675908 12.6534 -0.0953203 13.2206 0.209705 13.6129L0.292893 13.7071C0.653377 14.0676 1.22061 14.0953 
+                                    1.6129 13.7903L1.70711 13.7071L7.70711 7.70711C8.06759 7.34662 8.09532 6.77939 7.7903 6.3871L7.70711 6.29289L1.70711 
+                                    0.292893C1.31658 -0.0976311 0.683418 -0.0976311 0.292893 0.292893Z
+                                    </Path.Data>
+                                </Path>
+                            </Border>
+
+                        </Grid>
+                    </Border>
+                </Grid>
+
+                <!--右侧面板-->
+                <Border Name="PropertyContainer" Grid.Column="3" Visibility="Hidden"></Border>
+            </Grid>
         </Grid>
+
+        <Border Name="PopupBorder" Background="#A0000000" Visibility="Collapsed">
+            <Grid>
+
+                <!--文件信息-->
+                <Grid Name="FileInfoUI"  Width="422" Height="680" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" Visibility="Collapsed">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                        <ColumnDefinition Width="*"></ColumnDefinition>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="auto"></RowDefinition>
+                        <RowDefinition Height="*"></RowDefinition>
+                    </Grid.RowDefinitions>
+
+                    <TextBlock Width="50" Height="20" FontSize="14" LineHeight="16" Margin="12,6,0,0" HorizontalAlignment="Left">FileInfo:</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">
+                                <Path.Data>
+                                    M6.69495 6L11.5 1.19495L10.805 0.5L6 5.30505L1.19495 0.5L0.5 1.19495L5.30505 6L0.5 10.805L1.19495 11.5L6 6.69495L10.805 11.5L11.5 10.805L6.69495 6Z
+                                </Path.Data>
+                            </Path>
+                        </Button.Content>
+                    </Button>
+                    <cpdftools:CPDFInfoControl Grid.Row="1" Margin="25,10,25,0" Grid.ColumnSpan="2" Name="FileInfoControl"></cpdftools:CPDFInfoControl>
+                </Grid>
+
+                <!--密码验证-->
+                <local:PasswordDialog x:Name="PasswordUI" Visibility="Collapsed"></local:PasswordDialog>
+            </Grid>
+
+        </Border>
     </Grid>
 </Window>

+ 483 - 86
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/MainWindow.xaml.cs

@@ -1,5 +1,7 @@
-using ComPDFKit.PDFPage;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
 using compdfkit_tools.Edit;
+using compdfkit_tools.Helper;
 using compdfkit_tools.PDFControl;
 using ComPDFKitViewer;
 using ComPDFKitViewer.PdfViewer;
@@ -9,21 +11,11 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Diagnostics;
 using System.Drawing;
-using System.Linq;
 using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Xml.Linq;
 
 namespace edit_ctrl_demo
 {
@@ -39,9 +31,9 @@ namespace edit_ctrl_demo
         {
             get
             {
-                if (PDFView != null)
+                if (pdfViewControl != null&& pdfViewControl.PDFView!=null)
                 {
-                    return PDFView.UndoManager.CanUndo;
+                    return pdfViewControl.PDFView.UndoManager.CanUndo;
                 }
                 return false;
             }
@@ -54,9 +46,9 @@ namespace edit_ctrl_demo
         {
             get
             {
-                if (PDFView != null)
+                if (pdfViewControl != null && pdfViewControl.PDFView != null)
                 {
-                    return PDFView.UndoManager.CanRedo;
+                    return pdfViewControl.PDFView.UndoManager.CanRedo;
                 }
                 return false;
             }
@@ -70,8 +62,10 @@ namespace edit_ctrl_demo
         /// <summary>
         /// 缩放比例
         /// </summary>
-        private double[] zoomLevel = { 1.00f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
+        private PDFViewControl passwordViewer;
+        private PDFViewControl pdfViewControl;
 
+        private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
         public MainWindow()
         {
             InitializeComponent();
@@ -95,20 +89,104 @@ namespace edit_ctrl_demo
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
             LoadDefaultDocument();
-            TitleBarTool.OpenFileEvent += TitleBarTool_OpenFileEvent;
-            PDFView.PDFEditActiveHandler += PDFView_PDFEditActiveHandler;
-            PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-            PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
-            PDFView.MouseWheelZoomHandler += PDFView_MouseWheelZoomHandler;
+            BindZoomLevel();
+          
+            if(pdfViewControl!=null)
+            {
+                pdfViewControl.PDFView.PDFEditActiveHandler += PDFView_PDFEditActiveHandler;
+                pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
+                pdfViewControl.PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
+            }
         }
 
-        /// <summary>
-        /// 鼠标滚轮缩放事件
-        /// </summary>
-        private void PDFView_MouseWheelZoomHandler(object sender, bool e)
+        private void BindZoomLevel()
+        {
+            foreach (double zoomLevel in zoomLevelList)
+            {
+                ComboBoxItem zoomItem = new ComboBoxItem();
+                zoomItem.Content = zoomLevel + "%";
+                ZoomComboBox.Items.Add(zoomItem);
+            }
+        }
+
+        private void LoadDocument()
         {
-            double newZoom = CheckZoomLevel(PDFView.ZoomFactor + (e ? 0.01 : -0.01), e);
-            PDFView?.Zoom(newZoom);
+            pdfViewControl.PDFView?.Load();
+            PDFGrid.Child = pdfViewControl;
+            pdfViewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
+            pdfViewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
+            PasswordUI.Closed += PasswordUI_Closed;
+            PasswordUI.Canceled += PasswordUI_Canceled;
+            PasswordUI.Confirmed += PasswordUI_Confirmed;
+
+            UIElement currentBotaTool = GetBotaTool();
+            if (currentBotaTool is CPDFSearchControl)
+            {
+                ((CPDFSearchControl)currentBotaTool).InitWithPDFViewer(pdfViewControl.PDFView);
+            }
+
+            if (currentBotaTool is CPDFThumbnailControl)
+            {
+                ((CPDFThumbnailControl)currentBotaTool).InitWithPDFViewer(pdfViewControl.PDFView);
+                ((CPDFThumbnailControl)currentBotaTool).ThumbLoaded = false;
+                ((CPDFThumbnailControl)currentBotaTool).LoadThumb();
+            }
+
+            if (currentBotaTool is CPDFBookmarkControl)
+            {
+                ((CPDFBookmarkControl)currentBotaTool).InitWithPDFViewer(pdfViewControl.PDFView);
+                ((CPDFBookmarkControl)currentBotaTool).LoadBookmark();
+            }
+
+            ZoomTextBox.Text = string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)) + "%";
+
+            SetEditMode();
+        }
+
+        private void PasswordUI_Confirmed(object sender, string e)
+        {
+            if (passwordViewer != null && passwordViewer.PDFView != null && passwordViewer.PDFView.Document != null)
+            {
+                passwordViewer.PDFView.Document.UnlockWithPassword(e);
+                if (passwordViewer.PDFView.Document.IsLocked == false)
+                {
+                    PasswordUI.SetShowError("", Visibility.Collapsed);
+                    PasswordUI.ClearPassword();
+                    PasswordUI.Visibility = Visibility.Collapsed;
+                    PopupBorder.Visibility = Visibility.Collapsed;
+                    pdfViewControl = passwordViewer;
+                    LoadDocument();
+                }
+                else
+                {
+                    PasswordUI.SetShowError("error", Visibility.Visible);
+                }
+            }
+        }
+
+        private void PasswordUI_Canceled(object sender, EventArgs e)
+        {
+            PopupBorder.Visibility = Visibility.Collapsed;
+            PasswordUI.Visibility = Visibility.Collapsed;
+        }
+
+        private void PasswordUI_Closed(object sender, EventArgs e)
+        {
+            PopupBorder.Visibility = Visibility.Collapsed;
+            PasswordUI.Visibility = Visibility.Collapsed;
+        }
+
+        private void PdfViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
+        {
+            if (e.Key == "PageNum")
+            {
+                PageRangeText.Text = string.Format("{0}/{1}", e.Value, pdfViewControl.PDFView.Document.PageCount);
+            }
+
+            if (e.Key == "Zoom")
+            {
+                ZoomTextBox.Text = string.Format("{0}", (int)((double)e.Value * 100)) + "%";
+            }
         }
 
         /// <summary>
@@ -127,16 +205,16 @@ namespace edit_ctrl_demo
             }
 
             zoom *= 100;
-            for (int i = 0; i < zoomLevel.Length - 1; i++)
+            for (int i = 0; i < zoomLevelList.Length - 1; i++)
             {
-                if (zoom > zoomLevel[i] && zoom <= zoomLevel[i + 1] && IsGrowth)
+                if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
                 {
-                    standardZoom = zoomLevel[i + 1];
+                    standardZoom = zoomLevelList[i + 1];
                     break;
                 }
-                if (zoom >= zoomLevel[i] && zoom < zoomLevel[i + 1] && !IsGrowth)
+                if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
                 {
-                    standardZoom = zoomLevel[i];
+                    standardZoom = zoomLevelList[i];
                     break;
                 }
             }
@@ -183,7 +261,8 @@ namespace edit_ctrl_demo
             lastPDFEditEvent = e;
             if (e == null)
             {
-                PDFEditContainer.Child= null;
+                PropertyContainer.Child= null;
+                PropertyContainer.Visibility= Visibility.Collapsed;
                 return;
             }
            
@@ -196,40 +275,343 @@ namespace edit_ctrl_demo
             {
                 PDFTextEditControl textEditControl = new PDFTextEditControl();
                 textEditControl.SetPDFTextEditData(e);
-                PDFEditContainer.Child = textEditControl;
+                PropertyContainer.Child = textEditControl;
+                PropertyContainer.Visibility = Visibility.Visible;
                 return;
             }
 
-            if (e.EditType == CPDFEditType.EditImage)
+            if (e.EditType == CPDFEditType.EditImage && pdfViewControl!=null)
             {
                 PDFImageEditControl imageEditControl = new PDFImageEditControl();
-                imageEditControl.InitWithPDFViewer(PDFView);
+                imageEditControl.InitWithPDFViewer(pdfViewControl.PDFView);
                 imageEditControl.SetPDFImageEditData(e);
-                PDFEditContainer.Child = imageEditControl;
+                PropertyContainer.Child = imageEditControl;
+                PropertyContainer.Visibility = Visibility.Visible;
                 return;
             }
         }
 
         /// <summary>
-        /// 工具栏选择文件对话框事件通知
+        /// 加载显示默认文档
         /// </summary>
-        private void TitleBarTool_OpenFileEvent(object sender, string filePath)
+        private void LoadDefaultDocument()
         {
-            ClearPDFEditState();
-            PDFView?.CloseDocument();
-            PDFView?.InitDocument(filePath);
-            PDFView?.Load();
-            PDFView?.SetMouseMode(MouseModes.PanTool);
+            string defaultFilePath = "..\\..\\..\\..\\developer_guide_windows.pdf";
+            pdfViewControl = new PDFViewControl();
+            pdfViewControl.PDFView.InitDocument(defaultFilePath);
+            LoadDocument();
         }
 
         /// <summary>
-        /// 加载显示默认文档
+        /// 搜索工具点击处理
         /// </summary>
-        private void LoadDefaultDocument()
+        private void SearchToolButton_Click(object sender, RoutedEventArgs e)
         {
-            string defaultFilePath = "..\\..\\..\\..\\developer_guide_windows.pdf";
-            PDFView?.InitDocument(defaultFilePath);
-            PDFView?.Load();
+            UIElement botaTool = GetBotaTool();
+            if (botaTool == null || !(botaTool is CPDFSearchControl))
+            {
+                CPDFSearchControl searchControl = new CPDFSearchControl();
+                if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+                {
+                    searchControl.InitWithPDFViewer(pdfViewControl.PDFView);
+                }
+                SetBotaTool(searchControl);
+            }
+            ExpandBotaTool(SearchToolButton.IsChecked == true);
+            ClearToolState(SearchToolButton);
+        }
+
+        /// <summary>
+        /// 缩略图列表点击处理
+        /// </summary>
+        private void ThumbToolButton_Click(object sender, RoutedEventArgs e)
+        {
+            UIElement botaTool = GetBotaTool();
+            if (botaTool == null || !(botaTool is CPDFThumbnailControl))
+            {
+                CPDFThumbnailControl thumbControl = new CPDFThumbnailControl();
+
+                if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+                {
+                    thumbControl.InitWithPDFViewer(pdfViewControl.PDFView);
+                    thumbControl.LoadThumb();
+                }
+                SetBotaTool(thumbControl);
+            }
+            ExpandBotaTool(ThumbToolButton.IsChecked == true);
+            ClearToolState(ThumbToolButton);
+        }
+
+        /// <summary>
+        /// 书签列表点击处理
+        /// </summary>
+        private void BookmarkToolButtonn_Click(object sender, RoutedEventArgs e)
+        {
+            UIElement botaTool = GetBotaTool();
+            if (botaTool == null || !(botaTool is CPDFBookmarkControl))
+            {
+                CPDFBookmarkControl bookmarkControl = new CPDFBookmarkControl();
+
+                if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+                {
+                    bookmarkControl.InitWithPDFViewer(pdfViewControl.PDFView);
+                    bookmarkControl.LoadBookmark();
+                }
+                SetBotaTool(bookmarkControl);
+            }
+            ExpandBotaTool(BookmarkToolButton.IsChecked == true);
+            ClearToolState(BookmarkToolButton);
+        }
+
+        /// <summary>
+        /// 大纲列表处理
+        /// </summary>
+        private void OutlineToolButton_Click(object sender, RoutedEventArgs e)
+        {
+            UIElement botaTool = GetBotaTool();
+            if (botaTool == null || !(botaTool is CPDFOutlineControl))
+            {
+                CPDFOutlineControl outlineControl = new CPDFOutlineControl();
+
+                if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+                {
+                    outlineControl.InitWithPDFViewer(pdfViewControl.PDFView);
+                }
+                SetBotaTool(outlineControl);
+            }
+            ExpandBotaTool(OutlineToolButton.IsChecked == true);
+            ClearToolState(OutlineToolButton);
+
+        }
+        /// <summary>
+        /// 设置Bota工具内容
+        /// </summary>
+        /// <param name="newChild"></param>
+        private void SetBotaTool(UIElement newChild)
+        {
+            BotaToolContainer.Child = newChild;
+        }
+
+        /// <summary>
+        /// 获取Bota工具
+        /// </summary>
+        /// <returns></returns>
+        private UIElement GetBotaTool()
+        {
+            return BotaToolContainer.Child;
+        }
+
+        /// <summary>
+        /// 展开Bota工具
+        /// </summary>
+        /// <param name="isExpand"></param>
+        private void ExpandBotaTool(bool isExpand)
+        {
+            BotaToolContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+        }
+
+        /// <summary>
+        /// 清除左边工具栏状态
+        /// </summary>
+        private void ClearToolState(UIElement ignoreTool)
+        {
+            foreach (UIElement child in BotaSideTool.Children)
+            {
+                if (child != ignoreTool && child is ToggleButton buttonTool)
+                {
+                    buttonTool.IsChecked = false;
+                }
+            }
+        }
+
+        private void ToolExpand_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton expandBtn = sender as ToggleButton;
+            if (expandBtn != null)
+            {
+                bool isExpand = expandBtn.IsChecked == true;
+                ExpandLeftPanel(isExpand);
+                if (isExpand)
+                {
+                    ThumbToolButton.IsChecked = isExpand;
+                    ThumbToolButton_Click(ThumbToolButton, new RoutedEventArgs());
+                }
+            }
+        }
+
+        private void ExpandSearchBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ExpandLeftPanel(true);
+            SearchToolButton.IsChecked = true;
+            SearchToolButton_Click(SearchToolButton, new RoutedEventArgs());
+        }
+
+        private void ExpandLeftPanel(bool isExpand)
+        {
+            ExpandToolContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            Splitter.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+            if (isExpand)
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(260);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(15);
+            }
+            else
+            {
+                BodyGrid.ColumnDefinitions[0].Width = new GridLength(0);
+                BodyGrid.ColumnDefinitions[1].Width = new GridLength(0);
+            }
+        }
+
+        private void Border_MouseEnter(object sender, MouseEventArgs e)
+        {
+            FloatPageTool.Visibility = Visibility.Visible;
+        }
+
+        private void PDFGrid_MouseMove(object sender, MouseEventArgs e)
+        {
+            FloatPageTool.Visibility = Visibility.Collapsed;
+        }
+
+        private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
+        {
+            ToggleButton toggleButton = sender as ToggleButton;
+            if (toggleButton != null)
+            {
+                if (toggleButton.IsChecked == true)
+                {
+                    CPDFDisplaySettingsControl displayPanel = new CPDFDisplaySettingsControl();
+                    displayPanel.InitWithPDFViewer(pdfViewControl.PDFView);
+                    PropertyContainer.Child = displayPanel;
+                    PropertyContainer.Visibility = Visibility.Visible;
+                }
+                else
+                {
+                    PropertyContainer.Child = null;
+                    PropertyContainer.Visibility = Visibility.Collapsed;
+                }
+            }
+        }
+
+        private void ZoomComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            ComboBoxItem selectItem = ZoomComboBox.SelectedItem as ComboBoxItem;
+            if (selectItem != null && selectItem.Content != null && pdfViewControl != null)
+            {
+                if (double.TryParse(selectItem.Content.ToString().TrimEnd('%'), out double zoomLevel))
+                {
+                    pdfViewControl.PDFView.Zoom(zoomLevel / 100D);
+                    ZoomTextBox.Text = string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)) + "%";
+                }
+            }
+        }
+
+        private void ZoomInBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null)
+            {
+                double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor + 0.01, true);
+                pdfViewControl.PDFView.Zoom(newZoom);
+                ZoomTextBox.Text = string.Format("{0}", (int)(newZoom * 100)) + "%";
+            }
+        }
+
+        private void ZoomOutBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null)
+            {
+                double newZoom = CheckZoomLevel(pdfViewControl.PDFView.ZoomFactor - 0.01, false);
+                pdfViewControl.PDFView.Zoom(newZoom);
+                ZoomTextBox.Text = string.Format("{0}", (int)(newZoom * 100)) + "%";
+            }
+        }
+
+        private void NextPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex + 1);
+        }
+
+        private void PrevPageBorder_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            pdfViewControl.PDFView?.GoToPage(pdfViewControl.PDFView.CurrentIndex - 1);
+        }
+
+        private void PageInfoBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PasswordUI.Visibility = Visibility.Collapsed;
+            FileInfoUI.Visibility = Visibility.Visible;
+            FileInfoControl.InitWithPDFViewer(pdfViewControl.PDFView);
+            PopupBorder.Visibility = Visibility.Visible;
+        }
+
+        private void FileInfoCloseBtn_Click(object sender, RoutedEventArgs e)
+        {
+            PopupBorder.Visibility = Visibility.Collapsed;
+        }
+
+        private void OpenFile_Click(object sender, RoutedEventArgs e)
+        {
+            try
+            {
+                string filePath = CommonHelper.GetFilePathOrEmpty();
+                if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
+                {
+                    passwordViewer = new PDFViewControl();
+                    passwordViewer.PDFView.InitDocument(filePath);
+                    if (passwordViewer.PDFView.Document == null)
+                    {
+                        MessageBox.Show("Open File Failed");
+                        return;
+                    }
+
+                    if (passwordViewer.PDFView.Document.IsLocked)
+                    {
+                        PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " password encrypted.");
+                        PasswordUI.ClearPassword();
+                        PopupBorder.Visibility = Visibility.Visible;
+                        PasswordUI.Visibility = Visibility.Visible;
+                    }
+                    else
+                    {
+                        pdfViewControl = passwordViewer;
+                        LoadDocument();
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+
+        }
+
+        private void SaveFileBtn_Click(object sender, RoutedEventArgs e)
+        {
+            if (pdfViewControl != null && pdfViewControl.PDFView != null && pdfViewControl.PDFView.Document != null)
+            {
+                try
+                {
+                    CPDFDocument pdfDoc = pdfViewControl.PDFView.Document;
+                    if (pdfDoc.WriteToLoadedPath())
+                    {
+                        return;
+                    }
+
+                    SaveFileDialog saveDialog = new SaveFileDialog();
+                    saveDialog.Filter = "(*.pdf)|*.pdf";
+                    saveDialog.DefaultExt = ".pdf";
+                    saveDialog.OverwritePrompt = true;
+
+                    if (saveDialog.ShowDialog() == true)
+                    {
+                        pdfDoc.WriteToFilePath(saveDialog.FileName);
+                    }
+                }
+                catch (Exception ex)
+                {
+
+                }
+            }
         }
 
         /// <summary>
@@ -238,21 +620,21 @@ namespace edit_ctrl_demo
         private void PDFTextEditButton_Click(object sender, RoutedEventArgs e)
         {
             ToggleButton senderBtn=sender as ToggleButton;
-            if(senderBtn != null)
+            if(senderBtn != null && pdfViewControl!=null)
             {
                 ClearPDFEditState(senderBtn);
                 if (senderBtn.IsChecked == true)
                 {
-                    PDFView?.SetPDFEditType(CPDFEditType.EditText);
-                    PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
-                    PDFView?.SetMouseMode(MouseModes.PDFEdit);
-                    PDFView?.ReloadDocument();
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText);
+                    pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditText);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    pdfViewControl.PDFView?.ReloadDocument();
                 }
                 else
                 {
-                    PDFView?.SetPDFEditType(CPDFEditType.None);
-                    PDFView?.SetMouseMode(MouseModes.PanTool);
-                    PDFView?.ReloadDocument();
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.None);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PanTool);
+                    pdfViewControl.PDFView?.ReloadDocument();
                 }
             }
         }
@@ -263,19 +645,19 @@ namespace edit_ctrl_demo
         private void PDFImageEditButton_Click(object sender, RoutedEventArgs e)
         {
             ToggleButton senderBtn = sender as ToggleButton;
-            if (senderBtn != null)
+            if (senderBtn != null && pdfViewControl!=null)
             {
                 ClearPDFEditState(senderBtn);
                 senderBtn.IsChecked = false;
-                PDFView?.SetPDFEditType(CPDFEditType.EditImage);
-                PDFView?.SetMouseMode(MouseModes.PDFEdit);
-                PDFView?.ReloadDocument();
+                pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditImage);
+                pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                pdfViewControl.PDFView?.ReloadDocument();
                 OpenFileDialog openFileDialog = new OpenFileDialog();
                 openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.png;*.bmp)|*.jpg;*.jpeg;*.png;*.bmp;";
                 if (openFileDialog.ShowDialog() == true)
                 {
-                    PDFView?.SetPDFEditCreateType(CPDFEditType.EditImage);
-                    PDFView?.AddPDFEditImage(openFileDialog.FileName);
+                    pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.EditImage);
+                    pdfViewControl.PDFView?.AddPDFEditImage(openFileDialog.FileName);
                 }
             }
         }
@@ -288,8 +670,7 @@ namespace edit_ctrl_demo
             List<ToggleButton> clearBtnList = new List<ToggleButton>()
             { 
                 PDFTextEditButton,
-                PDFImageEditButton,
-                PDFEditBtn,
+                PDFImageEditButton
             };
 
             foreach (ToggleButton item in clearBtnList)
@@ -300,8 +681,11 @@ namespace edit_ctrl_demo
                 }
                 item.IsChecked = false;
             }
-            
-            PDFEditContainer.Child = null;
+
+            if(PropertyContainer!=null)
+            {
+                PropertyContainer.Child = null;
+            }
         }
 
         /// <summary>
@@ -309,7 +693,10 @@ namespace edit_ctrl_demo
         /// </summary>
         private void UndoBtn_Click(object sender, RoutedEventArgs e)
         {
-            PDFView?.UndoManager?.Undo();
+            if(pdfViewControl!=null && pdfViewControl.PDFView!=null)
+            {
+                pdfViewControl.PDFView.UndoManager?.Undo();
+            }
         }
 
         /// <summary>
@@ -317,7 +704,10 @@ namespace edit_ctrl_demo
         /// </summary>
         private void RedoBtn_Click(object sender, RoutedEventArgs e)
         {
-            PDFView?.UndoManager?.Redo();
+            if (pdfViewControl != null && pdfViewControl.PDFView != null)
+            {
+                pdfViewControl.PDFView.UndoManager?.Redo();
+            }
         }
 
         /// <summary>
@@ -341,7 +731,7 @@ namespace edit_ctrl_demo
                     {
                         PDFTextEditControl textEditControl = new PDFTextEditControl();
                         textEditControl.SetPDFTextEditData(lastPDFEditEvent);
-                        PDFEditContainer.Child = textEditControl;
+                        PropertyContainer.Child = textEditControl;
                     }
                 };
                 editCommand.PopupMenu.Items.Add(propertyMenu);
@@ -400,7 +790,7 @@ namespace edit_ctrl_demo
                         {
                             lastPDFEditEvent.ReplaceImagePath = openFileDialog.FileName;
                             lastPDFEditEvent.UpdatePDFEditByEventArgs();
-                            PDFView?.ClearSelectPDFEdit();
+                            pdfViewControl.PDFView?.ClearSelectPDFEdit();
                         }
                     }
                 };
@@ -410,9 +800,9 @@ namespace edit_ctrl_demo
                 exportMenu.Header = "导出";
                 exportMenu.Click += (o, p) =>
                 {
-                    if (PDFView != null)
+                    if (pdfViewControl != null && pdfViewControl.PDFView!=null)
                     {
-                        Dictionary<int, List<Bitmap>> imageDict = PDFView.GetSelectedImages();
+                        Dictionary<int, List<Bitmap>> imageDict = pdfViewControl.PDFView.GetSelectedImages();
                         if (imageDict != null && imageDict.Count > 0)
                         {
                             System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
@@ -528,24 +918,31 @@ namespace edit_ctrl_demo
         /// <summary>
         /// 进入文字和图片编辑
         /// </summary>
-        private void PDFEditBtn_Click(object sender, RoutedEventArgs e)
+        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            ToggleButton senderBtn = sender as ToggleButton;
-            if (senderBtn != null)
+            SetEditMode();
+        }
+
+        private void SetEditMode()
+        {
+            ClearPDFEditState(null);
+
+            if (pdfViewControl != null && ViewComboBox != null)
             {
-                ClearPDFEditState(senderBtn);
-                if (senderBtn.IsChecked == true)
+                if (ViewComboBox.SelectedIndex == 0)
                 {
-                    PDFView?.SetPDFEditType(CPDFEditType.EditText|CPDFEditType.EditImage);
-                    PDFView?.SetPDFEditCreateType(CPDFEditType.None);
-                    PDFView?.SetMouseMode(MouseModes.PDFEdit);
-                    PDFView?.ReloadDocument();
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.None);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PanTool);
+                    pdfViewControl.PDFView?.ReloadDocument();
+                    return;
                 }
-                else
+
+                if (ViewComboBox.SelectedIndex == 1)
                 {
-                    PDFView?.SetPDFEditType(CPDFEditType.None);
-                    PDFView?.SetMouseMode(MouseModes.PanTool);
-                    PDFView?.ReloadDocument();
+                    pdfViewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
+                    pdfViewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
+                    pdfViewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
+                    pdfViewControl.PDFView?.ReloadDocument();
                 }
             }
         }

+ 61 - 0
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/PasswordDialog.xaml

@@ -0,0 +1,61 @@
+<UserControl x:Class="edit_ctrl_demo.PasswordDialog"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:edit_ctrl_demo"
+             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.ColumnDefinitions>
+            <ColumnDefinition Width="*"></ColumnDefinition>
+            <ColumnDefinition Width="*"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="auto"></RowDefinition>
+            <RowDefinition Height="*"></RowDefinition>
+            <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>
+        
+        <Button Grid.Column="1" Width="16" Height="16" HorizontalAlignment="Right" Margin="0,8,8,0" BorderThickness="0" Click="PasswordDialogClose_Click">
+            <Button.Content>
+                <Path Fill="Black">
+                    <Path.Data>
+                        M6.69495 6L11.5 1.19495L10.805 0.5L6 5.30505L1.19495 0.5L0.5 1.19495L5.30505 6L0.5 10.805L1.19495 11.5L6 6.69495L10.805 11.5L11.5 10.805L6.69495 6Z
+                    </Path.Data>
+                </Path>
+            </Button.Content>
+        </Button>
+
+        <Grid Grid.Row="1" Margin="0,36,0,0" Grid.ColumnSpan="2">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="80"></ColumnDefinition>
+                <ColumnDefinition Width="*"></ColumnDefinition>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="auto"></RowDefinition>
+                <RowDefinition Height="auto"></RowDefinition>
+            </Grid.RowDefinitions>
+
+            <Image Width="32" Height="32" Source="pack://application:,,,/compdfkit-assets;component/Resource/warn.png"/>
+
+            <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 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>
+                </StackPanel>
+            </StackPanel>
+        </Grid>
+
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2" Margin="0,0,24,12" Grid.ColumnSpan="2">
+            <Button Width="112" Height="32" Click="PasswordDialogConfirm_Click">OK</Button>
+            <Button Width="112" Height="32" Margin="8,0,0,0" Click="PasswordDialogCancel_Click">Cancel</Button>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 64 - 0
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/PasswordDialog.xaml.cs

@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace edit_ctrl_demo
+{
+    /// <summary>
+    /// PasswordDialog.xaml 的交互逻辑
+    /// </summary>
+    public partial class PasswordDialog : UserControl
+    {
+        public event EventHandler Closed;
+
+        public event EventHandler Canceled;
+
+        public event EventHandler<string> Confirmed;
+        public PasswordDialog()
+        {
+            InitializeComponent();
+        }
+
+        public void SetShowText(string newText)
+        {
+            FileEncryptText.Text = newText;
+        }
+
+        private void PasswordDialogClose_Click(object sender, RoutedEventArgs e)
+        {
+            Closed?.Invoke(this, EventArgs.Empty);
+        }
+
+        private void PasswordDialogCancel_Click(object sender, RoutedEventArgs e)
+        {
+            Canceled?.Invoke(this, EventArgs.Empty);
+        }
+
+        private void PasswordDialogConfirm_Click(object sender, RoutedEventArgs e)
+        {
+            Confirmed?.Invoke(this, PasswordBoxText.Password);
+        }
+
+        public void SetShowError(string errorText,Visibility visible)
+        {
+            ErrorTipsText.Text = errorText;
+            ErrorTipsText.Visibility = visible;
+        }
+
+        public void ClearPassword()
+        {
+            PasswordBoxText.Password = string.Empty;
+        }
+    }
+}

+ 7 - 0
compdfkit_demo_windows/compdfkit/edit-ctrl-demo/edit-ctrl-demo.csproj

@@ -78,8 +78,15 @@
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Page Include="PasswordDialog.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="PasswordDialog.xaml.cs">
+      <DependentUpon>PasswordDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>