Browse Source

compdfkit(win) - 测量Demo 直线和折线的面板去掉周长和面积

zhuyi 1 year ago
parent
commit
433fe6cebb

+ 0 - 1
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFMeasureBarControl.xaml.cs

@@ -299,7 +299,6 @@ namespace Compdfkit_Tools.PDFControl
 
         private AnnotHandlerEventArgs CreatePolygonal()
         {
-
             PolygonMeasureArgs polygonMeasureArgs = new PolygonMeasureArgs();
             polygonMeasureArgs.LineColor = Colors.Red;
             polygonMeasureArgs.LineWidth = 2;

+ 16 - 0
Demo/Examples/Compdfkit_Tools/Measure/MeasureControl.xaml.cs

@@ -482,6 +482,21 @@ namespace Compdfkit_Tools.Measure
 
         private void MeasureInfoPanel_SettingClick(object sender, EventArgs e)
         {
+            if (sender is MeasureInfoPanel)
+            {
+                switch ((sender as MeasureInfoPanel).MeasureType)
+                {
+                    case CPDFMeasureType.CPDF_DISTANCE_MEASURE:
+                    case CPDFMeasureType.CPDF_PERIMETER_MEASURE:
+                        SettingPanel.ShowAreaAndLength(Visibility.Collapsed);
+                        break;
+                    case CPDFMeasureType.CPDF_AREA_MEASURE:
+                        SettingPanel.ShowAreaAndLength(Visibility.Visible);
+                        break;
+                    default:
+                        break;
+                }
+            }
             SettingPanel.ReturnToInfoPanel = true;
             SetInfoPanelVisble(false, true);
             SettingPanel.BindMeasureSetting();
@@ -505,6 +520,7 @@ namespace Compdfkit_Tools.Measure
             }
             InfoPanel.Visibility = measureInfo ? Visibility.Visible : Visibility.Collapsed;
             SettingPanel.Visibility = measureSetting ? Visibility.Visible : Visibility.Collapsed;
+
         }
 
         public void SetMeasureInfoType(CPDFMeasureType measureType)

+ 1 - 1
Demo/Examples/Compdfkit_Tools/Measure/MeasureSettingDialog.xaml

@@ -78,7 +78,7 @@
 
                 <Separator Grid.Row="2" Margin="0,10,0,10"></Separator>
 
-                <Grid Grid.Row="3" >
+                <Grid Grid.Row="3" Visibility="Collapsed">
                     <Grid.RowDefinitions>
                         <RowDefinition Height="auto"></RowDefinition>
                         <RowDefinition Height="auto"></RowDefinition>

+ 3 - 3
Demo/Examples/Compdfkit_Tools/Measure/MeasureSettingPanel.xaml

@@ -6,7 +6,7 @@
              xmlns:local="clr-namespace:Compdfkit_Tools.Measure"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
-    <Border BorderBrush="LightGray" CornerRadius="4" Background="White" Width="530" Height="350">
+    <Border x:Name="SettingPanel" BorderBrush="LightGray" CornerRadius="4" Background="White" Width="530" Height="350">
         <Border.Effect>
             <DropShadowEffect BlurRadius="20" ShadowDepth="0" Color="Black" Opacity="0.4"/>
         </Border.Effect>
@@ -75,8 +75,8 @@
             </Grid>
             
             <Separator Grid.Row="2" Margin="0,10,0,10"></Separator>
-            
-            <Grid Grid.Row="3" >
+
+            <Grid Grid.Row="3"  x:Name="AreaAndLength" Visibility="Collapsed">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="auto"></RowDefinition>
                     <RowDefinition Height="auto"></RowDefinition>

+ 14 - 1
Demo/Examples/Compdfkit_Tools/Measure/MeasureSettingPanel.xaml.cs

@@ -38,6 +38,19 @@ namespace Compdfkit_Tools.Measure
             ReturnToInfoPanel = false;
         }
 
+        public void ShowAreaAndLength(Visibility visibility)
+        {
+            if (visibility==Visibility.Visible)
+            {
+                SettingPanel.Height = 350;
+            }
+            else
+            {
+                SettingPanel.Height = 290;
+            }
+            AreaAndLength.Visibility = visibility;
+        }
+
         private void ButtonDone_Click(object sender, RoutedEventArgs e)
         {
             SaveMeasureSetting();
@@ -263,7 +276,7 @@ namespace Compdfkit_Tools.Measure
             MeasureSetting.IsShowLength = (bool)LengthCheckBox.IsChecked;
         }
 
-        public void ChangedCheckBoxIsChecked(bool Area,bool Lenght)
+        public void ChangedCheckBoxIsChecked(bool Area, bool Lenght)
         {
             AreaCheckBox.IsChecked = Area;
             LengthCheckBox.IsChecked = Lenght;

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

@@ -163,6 +163,7 @@ namespace Compdfkit_Tools.Measure.Property
                 PolygonalEvent?.UpdateAnnot();
             }
         }
+
         public void SetAnnotArgsData(PolygonMeasureArgs annotArgs)
         {
             Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();