Browse Source

compdfkit demo windows - slider

liuaoran 1 year ago
parent
commit
4c1b0e8036

+ 1 - 2
compdfkit_demo_windows/compdfkit/annotation-ctrl-demo/MainWindow.xaml

@@ -68,8 +68,7 @@
                     </ControlTemplate>
                 </GridSplitter.Template>
             </GridSplitter>
-            <Border Name="PropertyPanelContainer" Grid.Column="3" BorderThickness="0,0,1,0" BorderBrush="Gray" Visibility="Collapsed"></Border>
-
+            <Border Name="PropertyPanelContainer" Grid.Column="4" BorderThickness="0,0,1,0" BorderBrush="Gray" Visibility="Collapsed"></Border>
 
         </Grid>
         <StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center">

+ 1 - 0
compdfkit_demo_windows/compdfkit/annotation-ctrl-demo/MainWindow.xaml.cs

@@ -48,6 +48,7 @@ namespace annotation_ctrl_demo
             if (propertyPanel == null)
             {
                 CPDFAnnotationControl pdfAnnotationControl = new CPDFAnnotationControl();
+                pdfAnnotationControl.LoadAnnotationPanel(AnnotationProperties.Highlight);
                 SetPropertyPanel(pdfAnnotationControl);
             }
             ExpandPropertyPanel((sender as ToggleButton).IsChecked == true);

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationControl/CPDFAnnotationControl.xaml

@@ -7,6 +7,6 @@
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>
-            
+        <Border x:Name="AnnotationPanelContainer"></Border>
     </Grid>
 </UserControl>

+ 46 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using compdfkit_tools.PDFControl;
+using compdfkit_tools.PDFControlUI;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,9 +22,52 @@ namespace compdfkit_tools.Annotation.PDFAnnotationControl
     /// </summary>
     public partial class CPDFAnnotationControl : UserControl
     {
+
+
         public CPDFAnnotationControl()
         {
             InitializeComponent();
         }
+
+        /// <summary>
+        /// 获取Bota工具
+        /// </summary>
+        /// <returns></returns>
+        private UIElement GetAnnotationPanel()
+        {
+            return AnnotationPanelContainer.Child;
+        }
+
+        private void SetAnnotationPanel(UIElement newChild)
+        {
+            AnnotationPanelContainer.Child = newChild;
+        }
+
+        /// <summary>
+        /// 展开Bota工具
+        /// </summary>
+        /// <param name="isExpand"></param>
+        private void ExpandPanel(bool isExpand)
+        {
+            AnnotationPanelContainer.Visibility = isExpand ? Visibility.Visible : Visibility.Collapsed;
+        }
+
+        public void LoadAnnotationPanel(AnnotationProperties annotationProperties)
+        {
+            UIElement annotationPanel = GetAnnotationPanel();
+            switch (annotationProperties)
+            {
+                case AnnotationProperties.Highlight:
+                    CPDFHighlightUI CPDFHighlightUI = new CPDFHighlightUI();
+                SetAnnotationPanel(CPDFHighlightUI);
+                     ExpandPanel(true);
+                    break;
+                case AnnotationProperties.Underline:
+                    break;
+                case AnnotationProperties.Strikeout:
+                    break;
+                default: throw new ArgumentException();
+            }
+        }
     }
 }

+ 4 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/Annotation/PDFAnnotationUI/PDFMarkup/CPDFHighlightUI.xaml

@@ -3,6 +3,7 @@
              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:cpdfcommon="clr-namespace:compdfkit_tools.Common"
              mc:Ignorable="d" 
              d:DesignHeight="800" d:DesignWidth="300">
     <Grid>
@@ -19,12 +20,15 @@
         </StackPanel>
         <StackPanel Grid.Row="1" Margin="5">
             <TextBlock Text="Color"></TextBlock>
+            <cpdfcommon:ColorPickerControl></cpdfcommon:ColorPickerControl>
         </StackPanel>
         <StackPanel Grid.Row="2" Margin="5">
             <TextBlock Text="Opacity"></TextBlock>
+            <cpdfcommon:OpactiyControl Height="40"></cpdfcommon:OpactiyControl>
         </StackPanel>
         <StackPanel Grid.Row="3" Margin="5">
             <TextBlock Text="Note"></TextBlock>
+            <TextBox Height="150"></TextBox>
         </StackPanel>
     </Grid>
 </UserControl>

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

@@ -1,11 +1,10 @@
-<UserControl x:Class="compdfkit_tools.Common.PropertyControl.ColorPickerControl"
+<UserControl x:Class="compdfkit_tools.Common.ColorPickerControl"
              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:compdfkit_tools.Common.PropertyControl"
              mc:Ignorable="d" 
-                        d:DesignHeight="40" d:DesignWidth="220">
+             d:DesignHeight="40" d:DesignWidth="220">
     <UserControl.Resources>
         <Style x:Key="CommonColorRadioButton" TargetType="{x:Type RadioButton}">
             <Setter Property="HorizontalAlignment" Value="Center"></Setter>

+ 1 - 1
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PropertyControl/ColorPickerControl.xaml.cs

@@ -17,7 +17,7 @@ using System.Windows.Shapes;
 using RadioButton = System.Windows.Controls.RadioButton;
 using UserControl = System.Windows.Controls.UserControl;
 
-namespace compdfkit_tools.Common.PropertyControl
+namespace compdfkit_tools.Common
 {
     /// <summary>
     /// ColorSelectorControl.xaml 的交互逻辑

+ 17 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PropertyControl/OpactiyControl.xaml

@@ -0,0 +1,17 @@
+<UserControl x:Class="compdfkit_tools.Common.OpactiyControl"
+             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:cpdfcommon="clr-namespace:compdfkit_tools.Common"
+             mc:Ignorable="d" 
+             d:DesignHeight="40" d:DesignWidth="300">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition></ColumnDefinition>
+            <ColumnDefinition Width="80"></ColumnDefinition>
+        </Grid.ColumnDefinitions>
+        <Slider VerticalAlignment="Center"></Slider>
+        <cpdfcommon:DropDownNumberBoxControl Grid.Column="1" Unit="%" Maxium="100" Minimum="0"></cpdfcommon:DropDownNumberBoxControl>
+    </Grid>
+</UserControl>

+ 28 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/Common/PropertyControl/OpactiyControl.xaml.cs

@@ -0,0 +1,28 @@
+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 compdfkit_tools.Common
+{
+    /// <summary>
+    /// OpactiyControl.xaml 的交互逻辑
+    /// </summary>
+    public partial class OpactiyControl : UserControl
+    {
+        public OpactiyControl()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 7 - 0
compdfkit_demo_windows/compdfkit/compdfkit-tools/compdfkit-tools.csproj

@@ -97,6 +97,9 @@
     <Compile Include="Common\PropertyControl\DropDownNumberBoxControl.xaml.cs">
       <DependentUpon>DropDownNumberBoxControl.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Common\PropertyControl\OpactiyControl.xaml.cs">
+      <DependentUpon>OpactiyControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Helper\CommonHelper.cs" />
     <Compile Include="PDFView\PDFBookmark\PDFBookmarkControl\CPDFBookmarkControl.xaml.cs">
       <DependentUpon>CPDFBookmarkControl.xaml</DependentUpon>
@@ -241,6 +244,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Common\PropertyControl\OpactiyControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="PDFView\PDFBookmark\PDFBookmarkControl\CPDFBookmarkControl.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>