Просмотр исходного кода

compdfkit(win) - 测量Demo 选中测量属性面板参数调整

zhuyi 1 год назад
Родитель
Сommit
72af7e3076

Разница между файлами не показана из-за своего большого размера
+ 9 - 13
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFMeasureBarControl.xaml.cs


+ 0 - 7
Demo/Examples/Compdfkit_Tools/Compdfkit_Tools.csproj

@@ -341,9 +341,6 @@
     <Compile Include="Measure\Property\PolygonalProperty.xaml.cs">
       <DependentUpon>PolygonalProperty.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Measure\Property\RectanglesProperty.xaml.cs">
-      <DependentUpon>RectanglesProperty.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Measure\Property\MultilineProperty.xaml.cs">
       <DependentUpon>MultilineProperty.xaml</DependentUpon>
     </Compile>
@@ -865,10 +862,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Measure\Property\RectanglesProperty.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="Measure\Property\MultilineProperty.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 3 - 3
Demo/Examples/Compdfkit_Tools/Measure/MeasureControl.xaml.cs

@@ -123,18 +123,18 @@ namespace Compdfkit_Tools.Measure
                     case AnnotArgsType.LineMeasure:
                         LineMeasureArgs LineArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.LineMeasure).First() as LineMeasureArgs;
                         panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
-                        measurePropertyControl.SetPropertyForMeasureCreate(LineArgs);
+                        measurePropertyControl.SetPropertyForMeasureCreate(LineArgs, e);
                         break;
                     case AnnotArgsType.PolygonMeasure:
                         PolygonMeasureArgs polygonArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.PolygonMeasure).First() as PolygonMeasureArgs;
                         panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
-                        measurePropertyControl.SetPropertyForMeasureCreate(polygonArgs);
+                        measurePropertyControl.SetPropertyForMeasureCreate(polygonArgs, e);
                         break;
 
                     case AnnotArgsType.PolyLineMeasure:
                         PolyLineMeasureArgs polyLineArgs = e.GetAnnotHandlerEventArgs(AnnotArgsType.PolyLineMeasure).First() as PolyLineMeasureArgs;
                         panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
-                        measurePropertyControl.SetPropertyForMeasureCreate(polyLineArgs);
+                        measurePropertyControl.SetPropertyForMeasureCreate(polyLineArgs, e);
                         break;
                 }
             }

+ 26 - 5
Demo/Examples/Compdfkit_Tools/Measure/MeasurePropertyControl.xaml.cs

@@ -29,7 +29,7 @@ namespace Compdfkit_Tools.Measure
             InitializeComponent();
         }
 
-        public void SetPropertyForMeasureCreate(AnnotHandlerEventArgs Args)
+        public void SetPropertyForMeasureCreate(AnnotHandlerEventArgs Args, AnnotAttribEvent attribEvent)
         {
             if (Args == null)
             {
@@ -41,17 +41,38 @@ namespace Compdfkit_Tools.Measure
             {
                 case AnnotArgsType.LineMeasure:
                     StraightnessProperty straightnessProperty = new StraightnessProperty();
-                    straightnessProperty.SetAnnotArgsData((LineMeasureArgs)Args);
-                     currentPanel = straightnessProperty;
+                    if (attribEvent != null)
+                    {
+                        straightnessProperty.SetAnnotEventData(attribEvent);
+                    }
+                    else
+                    {
+                        straightnessProperty.SetAnnotArgsData((LineMeasureArgs)Args);
+                    }
+                    currentPanel = straightnessProperty;
                     break;
                 case AnnotArgsType.PolyLineMeasure:
                     MultilineProperty multilineProperty = new MultilineProperty();
-                    multilineProperty.SetAnnotArgsData((PolyLineMeasureArgs)Args);
+                    if (attribEvent != null)
+                    {
+                        multilineProperty.SetAnnotEventData(attribEvent);
+                    }
+                    else
+                    {
+                        multilineProperty.SetAnnotArgsData((PolyLineMeasureArgs)Args);
+                    }
                     currentPanel = multilineProperty;
                     break;
                 case AnnotArgsType.PolygonMeasure:
                     PolygonalProperty polygonalProperty = new PolygonalProperty();
-                    polygonalProperty.SetAnnotArgsData((PolygonMeasureArgs)Args);
+                    if (attribEvent != null)
+                    {
+                        polygonalProperty.SetAnnotEventData(attribEvent);
+                    }
+                    else
+                    {
+                        polygonalProperty.SetAnnotArgsData((PolygonMeasureArgs)Args);
+                    }
                     currentPanel = polygonalProperty;
                     break;
                 default:

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Measure/Property/MultilineProperty.xaml

@@ -41,7 +41,7 @@
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
                     <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FontColorPickerControl" Brush="Transparent" ColorChanged="FontColorPickerControl_ColorChanged"/>
+                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FontColorPickerControl" TransparentBtnProperty ="Collapsed" Brush="Transparent" ColorChanged="FontColorPickerControl_ColorChanged"/>
                 </StackPanel>
                 <StackPanel  Margin="5">
                     <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Measure/Property/MultilineProperty.xaml.cs

@@ -164,7 +164,7 @@ namespace Compdfkit_Tools.Measure.Property
             SetAnnotEventData(annotEvent);
         }
 
-        private void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        public void SetAnnotEventData(AnnotAttribEvent annotEvent)
         {
             MultilineEvent = null;
             if (annotEvent != null)

+ 3 - 8
Demo/Examples/Compdfkit_Tools/Measure/Property/PolygonalProperty.xaml

@@ -27,18 +27,13 @@
                     <TextBlock Text="Line Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
                     <cpdfcommon:ColorPickerControl x:Name="BorderColorPickerControl" Margin="0,8,0,0" Brush="Red" TransparentBtnProperty ="Collapsed" ColorChanged="BorderColorPickerControl_ColorChanged"/>
                 </StackPanel>
-                <StackPanel Height="68" Margin="5">
-                    <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl" Margin="0,8,0,0" OpacityChanged="CPDFOpacityControl_OpacityChanged"/>
-                </StackPanel>
-
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Line Color"  FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl x:Name="LineColorPickerControl" Margin="0,8,0,0" Brush="Red" TransparentBtnProperty ="Collapsed" ColorChanged="LineColorPickerControl_ColorChanged"/>
+                    <cpdfcommon:ColorPickerControl x:Name="FillColorPickerControl" Margin="0,8,0,0" Brush="Red" ColorChanged="FillColorPickerControl_ColorChanged"/>
                 </StackPanel>
                 <StackPanel Height="68" Margin="5">
                     <TextBlock Text="Opacity" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFLineOpacityControl" Margin="0,8,0,0" OpacityChanged="CPDFLineOpacityControl_OpacityChanged"/>
+                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl" Margin="0,8,0,0" OpacityChanged="CPDFOpacityControl_OpacityChanged"/>
                 </StackPanel>
                 <StackPanel x:Name="LineStyleStackPanel" Height="90" Margin="5">
                     <TextBlock Text="Line and Border Style"/>
@@ -46,7 +41,7 @@
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
                     <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl x:Name="FontColorPickerControl" Brush="Transparent" Margin="0,8,0,0" ColorChanged="FontColorPickerControl_ColorChanged"/>
+                    <cpdfcommon:ColorPickerControl x:Name="FontColorPickerControl" TransparentBtnProperty ="Collapsed" Brush="Transparent" Margin="0,8,0,0" ColorChanged="FontColorPickerControl_ColorChanged"/>
                 </StackPanel>
                 <StackPanel>
                     <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />

+ 9 - 15
Demo/Examples/Compdfkit_Tools/Measure/Property/PolygonalProperty.xaml.cs

@@ -126,30 +126,21 @@ namespace Compdfkit_Tools.Measure.Property
             }
         }
 
-        private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)
+        private void FillColorPickerControl_ColorChanged(object sender, EventArgs e)
         {
-            if (IsLoadedData)
-            {
-                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFOpacityControl.OpacityValue / 100D * 255D);
-                PolygonalEvent?.UpdateAnnot();
-            }
-        }
-
-        private void LineColorPickerControl_ColorChanged(object sender, EventArgs e)
-        {
-            SolidColorBrush checkBrush = LineColorPickerControl.GetBrush() as SolidColorBrush;
+            SolidColorBrush checkBrush = FillColorPickerControl.GetBrush() as SolidColorBrush;
             if (checkBrush != null)
             {
-                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Color, checkBrush.Color);
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.FillColor, checkBrush.Color);
                 PolygonalEvent?.UpdateAnnot();
             }
         }
 
-        private void CPDFLineOpacityControl_OpacityChanged(object sender, EventArgs e)
+        private void CPDFOpacityControl_OpacityChanged(object sender, EventArgs e)
         {
             if (IsLoadedData)
             {
-                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFLineOpacityControl.OpacityValue / 100D * 255D);
+                PolygonalEvent?.UpdateAttrib(AnnotAttrib.Transparency, CPDFOpacityControl.OpacityValue / 100D);
                 PolygonalEvent?.UpdateAnnot();
             }
         }
@@ -190,7 +181,7 @@ namespace Compdfkit_Tools.Measure.Property
             SetAnnotEventData(annotEvent);
         }
 
-        private void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        public void SetAnnotEventData(AnnotAttribEvent annotEvent)
         {
             PolygonalEvent = null;
             if (annotEvent != null)
@@ -202,6 +193,9 @@ namespace Compdfkit_Tools.Measure.Property
                         case AnnotAttrib.Color:
                             BorderColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
                             break;
+                        case AnnotAttrib.FillColor:
+                            FillColorPickerControl.SetCheckedForColor((Color)annotEvent.Attribs[attrib]);
+                            break;
                         case AnnotAttrib.Transparency:
                             double transparennt = Convert.ToDouble(annotEvent.Attribs[attrib]);
                             if (transparennt > 1)

+ 0 - 73
Demo/Examples/Compdfkit_Tools/Measure/Property/RectanglesProperty.xaml

@@ -1,73 +0,0 @@
-<UserControl x:Class="Compdfkit_Tools.Measure.Property.RectanglesProperty"
-             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.Measure.Property" xmlns:cpdfcommon="clr-namespace:Compdfkit_Tools.Common"
-             mc:Ignorable="d" 
-             d:DesignHeight="4550" d:DesignWidth="800">
-    <UserControl.Resources>
-        <ResourceDictionary>
-            <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
-            </ResourceDictionary.MergedDictionaries>
-        </ResourceDictionary>
-    </UserControl.Resources>
-    <ScrollViewer VerticalScrollBarVisibility="Auto">
-        <Grid Background="#FAFCFF">
-            <StackPanel Orientation="Vertical">
-                <Border BorderThickness="1" BorderBrush="#1A000000">
-                    <Grid  Height="40" Background="White" >
-                        <TextBlock x:Name="TitleTextBlock" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" FontFamily="Segoe UI"></TextBlock>
-                    </Grid>
-                </Border>
-                <StackPanel Height="75" Margin="5">
-                    <TextBlock Text="Line Color" ></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="BorderColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"></cpdfcommon:ColorPickerControl>
-                </StackPanel>
-                <StackPanel Height="60" Margin="5">
-                    <TextBlock Text="Opacity"></TextBlock>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFOpacityControl"></cpdfcommon:CPDFOpacityControl>
-                </StackPanel>
-
-                <StackPanel Height="75" Margin="5">
-                    <TextBlock Text="Line Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="LineColorPickerControl" Brush="Red" TransparentBtnProperty ="Collapsed"></cpdfcommon:ColorPickerControl>
-                </StackPanel>
-                <StackPanel Height="60" Margin="5">
-                    <TextBlock Text="Opacity"></TextBlock>
-                    <cpdfcommon:CPDFOpacityControl x:Name="CPDFLineOpacityControl"></cpdfcommon:CPDFOpacityControl>
-                </StackPanel>
-                <StackPanel x:Name="LineStyleStackPanel" Height="90" Margin="5">
-                    <TextBlock Text="Line and Border Style"></TextBlock>
-                    <cpdfcommon:CPDFLineStyleControl x:Name="CPDFLineStyleControl"></cpdfcommon:CPDFLineStyleControl>
-                </StackPanel>
-                <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
-                    <TextBlock Text="Font Color"></TextBlock>
-                    <cpdfcommon:ColorPickerControl x:Name="FillColorPickerControl" Brush="Transparent"></cpdfcommon:ColorPickerControl>
-                </StackPanel>
-                <StackPanel>
-                    <TextBlock  Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Text" FontSize="14" FontFamily="Segoe UI" FontWeight="Bold" />
-                    <ComboBox x:Name="FontCombox" Margin="0,8,0,0" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontCombox_SelectionChanged">
-                        <ComboBoxItem Content="Arial"/>
-                        <ComboBoxItem Content="Courier New"/>
-                        <ComboBoxItem Content="Times New Roman"/>
-                    </ComboBox>
-                    <StackPanel Orientation="Horizontal" >
-                        <ComboBox x:Name="FontStyleCombox"  Margin="0,8,0,0" Width="148" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontStyleCombox_SelectionChanged">
-                            <ComboBoxItem Content="Regular"/>
-                            <ComboBoxItem Content="Bold"/>
-                            <ComboBoxItem Content="Italic"/>
-                            <ComboBoxItem Content="Bold Italic"/>
-                        </ComboBox>
-                        <ComboBox x:Name="FontSizeCombox" Margin="4,8,0,0" Width="72" Style="{StaticResource ComboBoxStyle1}" SelectedIndex="0" SelectionChanged="FontSizeCombox_SelectionChanged"/>
-                    </StackPanel>
-                </StackPanel>
-                <StackPanel Height="160" Margin="5">
-                    <TextBlock Text="Note"></TextBlock>
-                    <TextBox Height="100"  x:Name="NoteTextBox"  TextChanged="NoteTextBox_TextChanged" TextWrapping="Wrap" AcceptsReturn="True"></TextBox>
-                </StackPanel>
-            </StackPanel>
-        </Grid>
-    </ScrollViewer>
-</UserControl>

+ 0 - 48
Demo/Examples/Compdfkit_Tools/Measure/Property/RectanglesProperty.xaml.cs

@@ -1,48 +0,0 @@
-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.Measure.Property
-{
-    /// <summary>
-    /// RectanglesProperty.xaml 的交互逻辑
-    /// </summary>
-    public partial class RectanglesProperty : UserControl
-    {
-        public RectanglesProperty()
-        {
-            InitializeComponent();
-        }
-
-        private void NoteTextBox_TextChanged(object sender, TextChangedEventArgs e)
-        {
-
-        }
-
-        private void FontStyleCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-
-        }
-
-        private void FontSizeCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-
-        }
-
-        private void FontCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-
-        }
-    }
-}

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Measure/Property/StraightnessProperty.xaml

@@ -54,7 +54,7 @@
                 </StackPanel>
                 <StackPanel x:Name="FontColorStackPanel" Height="75" Margin="5">
                     <TextBlock Text="Font Color" FontWeight="SemiBold" FontSize="14" LineHeight="16"  FontFamily="Segoe UI"/>
-                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FontColorPickerControl" Brush="Transparent"
+                    <cpdfcommon:ColorPickerControl Margin="0,8,0,0" x:Name="FontColorPickerControl" Brush="Transparent" TransparentBtnProperty ="Collapsed"
                                                    ColorChanged="FontColorPickerControl_ColorChanged"></cpdfcommon:ColorPickerControl>
                 </StackPanel>
                 <StackPanel Margin="5">

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Measure/Property/StraightnessProperty.xaml.cs

@@ -113,7 +113,7 @@ namespace Compdfkit_Tools.Measure.Property
             LineEvent?.UpdateAnnot();
         }
 
-        private void SetAnnotEventData(AnnotAttribEvent annotEvent)
+        public void SetAnnotEventData(AnnotAttribEvent annotEvent)
         {
             LineEvent = null;
             if(annotEvent!=null)

BIN
Demo/Examples/packages/ComPDFKit.NetFramework.1.9.1/build/x64/ComPDFKit.dll