Browse Source

compdfkit(win) - Settings -> Rolling Ratio

weixiangjie 1 year ago
parent
commit
c9f18d5f4d

+ 3 - 0
Demo/Examples/PDFViewer/App.config

@@ -41,6 +41,9 @@
             <setting name="IsLoadLastFileNeeded" serializeAs="String">
                 <value>False</value>
             </setting>
+            <setting name="Divisor" serializeAs="String">
+                <value>10</value>
+            </setting>
         </PDFViewer.Properties.Settings>
     </userSettings>
 </configuration>

+ 1 - 0
Demo/Examples/PDFViewer/MainPage.xaml.cs

@@ -185,6 +185,7 @@ namespace PDFViewer
 
             pdfViewer.PDFView.SetShowLink(Properties.Settings.Default.IsHighlightLinkArea);
             pdfViewer.PDFView.SetFormFieldHighlight(Properties.Settings.Default.IsHighlightFormArea);
+            pdfViewer.PDFView.SetScrollStepDivisor(Properties.Settings.Default.Divisor / 100.0);
         }
 
         /// <summary>

+ 12 - 0
Demo/Examples/PDFViewer/Properties/Settings.Designer.cs

@@ -104,5 +104,17 @@ namespace PDFViewer.Properties {
                 this["IsLoadLastFileNeeded"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("10")]
+        public int Divisor {
+            get {
+                return ((int)(this["Divisor"]));
+            }
+            set {
+                this["Divisor"] = value;
+            }
+        }
     }
 }

+ 3 - 0
Demo/Examples/PDFViewer/Properties/Settings.settings

@@ -23,6 +23,9 @@
     <Setting Name="IsLoadLastFileNeeded" Type="System.Boolean" Scope="User">
       <Value Profile="(Default)">False</Value>
     </Setting>
+    <Setting Name="Divisor" Type="System.Int32" Scope="User">
+      <Value Profile="(Default)">10</Value>
+    </Setting>
   </Settings>
 </SettingsFile>
 

+ 6 - 1
Demo/Examples/PDFViewer/SettingsDialog.xaml

@@ -4,6 +4,7 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:PDFViewer"
+        xmlns:common="clr-namespace:Compdfkit_Tools.Common;assembly=ComPDFKit_Tools"
         mc:Ignorable="d"
         Title="Settings" Height="580" Width="440"
         ShowInTaskbar="False"
@@ -103,7 +104,7 @@
     <Grid Margin="24,0,24,0">
         <Grid.RowDefinitions>
             <RowDefinition Height="106"></RowDefinition>
-            <RowDefinition Height="100"></RowDefinition>
+            <RowDefinition Height="150"></RowDefinition>
             <RowDefinition Height="35"></RowDefinition>
             <RowDefinition Height="45"/>
             <RowDefinition Height="180"></RowDefinition>
@@ -133,6 +134,10 @@
                     <TextBlock Text="{Binding  ConverterParameter=Setting_HighlightForms, Converter={StaticResource ResourceConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
                     <ToggleButton x:Name="HighlightFormTog" Click="HighlightFormTog_Click" Style="{StaticResource SliderSwitchToggleButtonStyle}" Height="32" HorizontalAlignment="Right"></ToggleButton>
                 </Grid>
+                <Grid Margin="0,0,0,8" Height="32">
+                    <TextBlock Text="{Binding  ConverterParameter=Setting_Divisor, Converter={StaticResource ResourceConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
+                    <common:NumericUpDownControl x:Name="DivisorTxb" Unit="%" Minimum="1" Maximum="100" Width="118" Height="32" HorizontalAlignment="Right"></common:NumericUpDownControl>
+                </Grid>
             </StackPanel>
         </Border>
         <TextBlock Text="{Binding  ConverterParameter=Title_GlobalSettings, Converter={StaticResource ResourceConverter}}" Background="White" Grid.Row="1" Height="20" FontSize="14" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="DemiBold" FontFamily="Microsoft YaHei" Margin="10,-10,0,0"></TextBlock>

+ 11 - 0
Demo/Examples/PDFViewer/SettingsDialog.xaml.cs

@@ -22,6 +22,7 @@ namespace PDFViewer
 
         private void MainWindow_Closing(object sender, CancelEventArgs e)
         {
+            Properties.Settings.Default.Divisor = GetDivisor();
             Properties.Settings.Default.Save();
             Compdfkit_Tools.Data.CPDFAnnotationData.Author = Properties.Settings.Default.DocumentAuthor;
         }
@@ -34,6 +35,15 @@ namespace PDFViewer
                 Process.Start(webLocation);
             }
         }
+        
+        private int GetDivisor()
+        {
+            if (!DivisorTxb.IsValueValid)
+            {
+                return 10;
+            }
+            return int.TryParse(DivisorTxb.Text, out int divisor) ? divisor : 10;
+        }
 
         private void SettingsDialog_Loaded(object sender, RoutedEventArgs e)
         {
@@ -41,6 +51,7 @@ namespace PDFViewer
             HighlightLinkTog.IsChecked = Properties.Settings.Default.IsHighlightLinkArea;
             AuthorTxb.Text = Properties.Settings.Default.DocumentAuthor;
             SelectCurrentLanguage();
+            DivisorTxb.Text = Properties.Settings.Default.Divisor.ToString();
         }
         
         private void SelectCurrentLanguage()

+ 10 - 1
Demo/Examples/PDFViewer/Strings/SettingDialog.Designer.cs

@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
 //
@@ -95,6 +95,15 @@ namespace PDFViewer.Strings.SettingDialog {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Rolling Ratio.
+        /// </summary>
+        internal static string Setting_Divisor {
+            get {
+                return ResourceManager.GetString("Setting_Divisor", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Highlight Form Fields.
         /// </summary>

+ 3 - 0
Demo/Examples/PDFViewer/Strings/SettingDialog.resx

@@ -75,4 +75,7 @@
     <data name="Tip_RestartTitle" xml:space="preserve">
         <value>Restart Application</value>
     </data>
+    <data name="Setting_Divisor" xml:space="preserve">
+        <value>Rolling Ratio</value>
+    </data>
 </root>

+ 3 - 0
Demo/Examples/PDFViewer/Strings/SettingDialog.zh.resx

@@ -68,4 +68,7 @@
     <data name="Tip_RestartTitle" xml:space="preserve">
         <value>重新启动应用</value>
     </data>
+    <data name="Setting_Divisor" xml:space="preserve">
+        <value>滚动比例</value>
+    </data>
 </root>