浏览代码

Updates to picture galleries and general improvements

Ruben 6 年之前
父节点
当前提交
677567654b

+ 17 - 11
PicView/App.config

@@ -53,10 +53,10 @@
                 <value>#F209A68E</value>
             </setting>
             <setting name="Beige" serializeAs="String">
-                <value>#FFEAD393</value>
+                <value>#FFE2C290</value>
             </setting>
             <setting name="BeigeMouse" serializeAs="String">
-                <value>#F2BAAB7E</value>
+                <value>#F2E2C290</value>
             </setting>
             <setting name="Teal" serializeAs="String">
                 <value>#FF931AF7</value>
@@ -73,11 +73,11 @@
             <setting name="CyanMouse" serializeAs="String">
                 <value>#F236BBFF</value>
             </setting>
-            <setting name="Yellow" serializeAs="String">
-                <value>#FFFEFE0F</value>
+            <setting name="Grey" serializeAs="String">
+                <value>#FF5F5449</value>
             </setting>
-            <setting name="YellowMouse" serializeAs="String">
-                <value>#F2FFFF43</value>
+            <setting name="GreyMouse" serializeAs="String">
+                <value>#F25F5449</value>
             </setting>
             <setting name="CallUpgrade" serializeAs="String">
                 <value>True</value>
@@ -91,23 +91,29 @@
             <setting name="ScrollEnabled" serializeAs="String">
                 <value>False</value>
             </setting>
-            <setting name="WindowStyle" serializeAs="String">
-                <value>0</value>
+            <setting name="ShowInterface" serializeAs="String">
+                <value>True</value>
             </setting>
             <setting name="SortPreference" serializeAs="String">
                 <value>0</value>
             </setting>
             <setting name="PicGallery" serializeAs="String">
-                <value>2</value>
+                <value>1</value>
             </setting>
             <setting name="Slidetimeren" serializeAs="String">
                 <value>10000</value>
             </setting>
             <setting name="Looping" serializeAs="String">
-                <value>True</value>
+                <value>False</value>
             </setting>
             <setting name="WindowBorderColorEnabled" serializeAs="String">
-                <value>False</value>
+                <value>True</value>
+            </setting>
+            <setting name="BgColorWhite" serializeAs="String">
+                <value>True</value>
+            </setting>
+            <setting name="FitToWindow" serializeAs="String">
+                <value>True</value>
             </setting>
         </PicView.Properties.Settings>
     </userSettings>

+ 14 - 13
PicView/App.xaml

@@ -6,6 +6,7 @@
     <Application.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
+                <!--<ResourceDictionary Source="lib\Styles\Backgrounds.xaml" />-->
                 <ResourceDictionary Source="lib\Styles\Colors.xaml" />
                 <ResourceDictionary Source="lib\Styles\Menu.xaml" />
                 <ResourceDictionary Source="lib\Styles\Button.xaml" />
@@ -25,9 +26,9 @@
                     <Setter.Value>
                         <ControlTemplate TargetType="Window">
                             <Border
-                            x:Name="WindowBorder"
-                            Margin="0"
-                            Background="{StaticResource WindowBackgroundColorBrushDefault}">
+                                x:Name="WindowBorder"
+                                Margin="0"
+                                Background="{StaticResource WindowBackgroundColorBrushDefault}">
                                 <Grid>
                                     <Border BorderThickness="1">
                                         <AdornerDecorator>
@@ -37,10 +38,10 @@
                                         </AdornerDecorator>
                                     </Border>
                                     <Border
-                                    BorderBrush="{DynamicResource WindowBackgroundColorBrush}"
-                                    BorderThickness="1"
-                                    Opacity=".4"
-                                    Visibility="{Binding IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Converter={StaticResource bool2VisibilityConverter}}" />
+                                        BorderBrush="{DynamicResource WindowBackgroundColorBrush}"
+                                        BorderThickness="1"
+                                        Opacity=".4"
+                                        Visibility="{Binding IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Converter={StaticResource bool2VisibilityConverter}}" />
                                 </Grid>
                             </Border>
                         </ControlTemplate>
@@ -49,17 +50,17 @@
                 <Setter Property="WindowChrome.WindowChrome">
                     <Setter.Value>
                         <WindowChrome
-                        CaptionHeight="0"
-                        CornerRadius="0"
-                        GlassFrameThickness="1"
-                        ResizeBorderThickness="1"
-                        UseAeroCaptionButtons="False" />
+                            CaptionHeight="0"
+                            CornerRadius="0"
+                            GlassFrameThickness="1"
+                            ResizeBorderThickness="1"
+                            UseAeroCaptionButtons="False" />
                     </Setter.Value>
                 </Setter>
             </Style>
         </ResourceDictionary>
     </Application.Resources>
     <JumpList.JumpList>
-        <JumpList ShowRecentCategory="False" ShowFrequentCategory="True"/>
+        <JumpList ShowFrequentCategory="True" ShowRecentCategory="False" />
     </JumpList.JumpList>
 </Application>

+ 13 - 1
PicView/MainWindow.xaml

@@ -228,6 +228,18 @@
                         Width="1"
                         Height="55"
                         Fill="{StaticResource BorderBrushAlt}" />
+                    <Rectangle
+                        Canvas.Left="0"
+                        Canvas.Top="0"
+                        Width="1"
+                        Height="55"
+                        Fill="{StaticResource BorderBrushAlt}" />
+                    <Rectangle
+                        Canvas.Left="205"
+                        Canvas.Top="0"
+                        Width="1"
+                        Height="55"
+                        Fill="{StaticResource BorderBrushAlt}" />
                     <Button
                         x:Name="LeftButton"
                         Width="100"
@@ -384,7 +396,7 @@
                             </Setter>
                         </Style>
                     </ScrollViewer.Style>
-                    <Border x:Name="imgBorder" Focusable="False">
+                    <Border x:Name="imgBorder" Focusable="False" Background="White" HorizontalAlignment="Center" VerticalAlignment="Center">
                         <Image
                             x:Name="img"
                             AllowDrop="True"

文件差异内容过多而无法显示
+ 233 - 573
PicView/MainWindow.xaml.cs


+ 6 - 1
PicView/PicVIew.csproj

@@ -53,7 +53,7 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>x64</PlatformTarget>
     <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
+    <Optimize>true</Optimize>
     <OutputPath>bin\Release\</OutputPath>
     <DefineConstants>
     </DefineConstants>
@@ -129,6 +129,7 @@
     <Compile Include="lib\ArchiveExtraction.cs" />
     <Compile Include="lib\FileAssociation.cs" />
     <Compile Include="lib\FileFunctions.cs" />
+    <Compile Include="lib\MonitorSize.cs" />
     <Compile Include="lib\NativeMethods.cs" />
     <Compile Include="lib\RecentFiles.cs" />
     <Compile Include="lib\UserControls\CustomControls\AutoScrollSign.xaml.cs">
@@ -159,6 +160,10 @@
     <Compile Include="lib\Windows\About.xaml.cs">
       <DependentUpon>About.xaml</DependentUpon>
     </Compile>
+    <Page Include="lib\Styles\Backgrounds.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="lib\Styles\Colors.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 1 - 1
PicView/Properties/AssemblyInfo.cs

@@ -52,6 +52,6 @@ using System.Windows;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("0.8.4.0")]
+[assembly: AssemblyFileVersion("0.8.4.6")]
 [assembly: NeutralResourcesLanguage("en")]
 

+ 41 - 17
PicView/Properties/Settings.Designer.cs

@@ -193,7 +193,7 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("#FFEAD393")]
+        [global::System.Configuration.DefaultSettingValueAttribute("#FFE2C290")]
         public global::System.Windows.Media.Color Beige {
             get {
                 return ((global::System.Windows.Media.Color)(this["Beige"]));
@@ -205,7 +205,7 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("#F2BAAB7E")]
+        [global::System.Configuration.DefaultSettingValueAttribute("#F2E2C290")]
         public global::System.Windows.Media.Color BeigeMouse {
             get {
                 return ((global::System.Windows.Media.Color)(this["BeigeMouse"]));
@@ -277,25 +277,25 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("#FFFEFE0F")]
-        public global::System.Windows.Media.Color Yellow {
+        [global::System.Configuration.DefaultSettingValueAttribute("#FF5F5449")]
+        public global::System.Windows.Media.Color Grey {
             get {
-                return ((global::System.Windows.Media.Color)(this["Yellow"]));
+                return ((global::System.Windows.Media.Color)(this["Grey"]));
             }
             set {
-                this["Yellow"] = value;
+                this["Grey"] = value;
             }
         }
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("#F2FFFF43")]
-        public global::System.Windows.Media.Color YellowMouse {
+        [global::System.Configuration.DefaultSettingValueAttribute("#F25F5449")]
+        public global::System.Windows.Media.Color GreyMouse {
             get {
-                return ((global::System.Windows.Media.Color)(this["YellowMouse"]));
+                return ((global::System.Windows.Media.Color)(this["GreyMouse"]));
             }
             set {
-                this["YellowMouse"] = value;
+                this["GreyMouse"] = value;
             }
         }
         
@@ -349,13 +349,13 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("0")]
-        public short WindowStyle {
+        [global::System.Configuration.DefaultSettingValueAttribute("True")]
+        public bool ShowInterface {
             get {
-                return ((short)(this["WindowStyle"]));
+                return ((bool)(this["ShowInterface"]));
             }
             set {
-                this["WindowStyle"] = value;
+                this["ShowInterface"] = value;
             }
         }
         
@@ -373,7 +373,7 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("2")]
+        [global::System.Configuration.DefaultSettingValueAttribute("1")]
         public byte PicGallery {
             get {
                 return ((byte)(this["PicGallery"]));
@@ -397,7 +397,7 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("True")]
+        [global::System.Configuration.DefaultSettingValueAttribute("False")]
         public bool Looping {
             get {
                 return ((bool)(this["Looping"]));
@@ -409,7 +409,7 @@ namespace PicView.Properties {
         
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]
+        [global::System.Configuration.DefaultSettingValueAttribute("True")]
         public bool WindowBorderColorEnabled {
             get {
                 return ((bool)(this["WindowBorderColorEnabled"]));
@@ -418,5 +418,29 @@ namespace PicView.Properties {
                 this["WindowBorderColorEnabled"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("True")]
+        public bool BgColorWhite {
+            get {
+                return ((bool)(this["BgColorWhite"]));
+            }
+            set {
+                this["BgColorWhite"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("True")]
+        public bool FitToWindow {
+            get {
+                return ((bool)(this["FitToWindow"]));
+            }
+            set {
+                this["FitToWindow"] = value;
+            }
+        }
     }
 }

+ 17 - 11
PicView/Properties/Settings.settings

@@ -45,10 +45,10 @@
       <Value Profile="(Default)">#F209A68E</Value>
     </Setting>
     <Setting Name="Beige" Type="System.Windows.Media.Color" Scope="User">
-      <Value Profile="(Default)">#FFEAD393</Value>
+      <Value Profile="(Default)">#FFE2C290</Value>
     </Setting>
     <Setting Name="BeigeMouse" Type="System.Windows.Media.Color" Scope="User">
-      <Value Profile="(Default)">#F2BAAB7E</Value>
+      <Value Profile="(Default)">#F2E2C290</Value>
     </Setting>
     <Setting Name="Teal" Type="System.Windows.Media.Color" Scope="User">
       <Value Profile="(Default)">#FF931AF7</Value>
@@ -65,11 +65,11 @@
     <Setting Name="CyanMouse" Type="System.Windows.Media.Color" Scope="User">
       <Value Profile="(Default)">#F236BBFF</Value>
     </Setting>
-    <Setting Name="Yellow" Type="System.Windows.Media.Color" Scope="User">
-      <Value Profile="(Default)">#FFFEFE0F</Value>
+    <Setting Name="Grey" Type="System.Windows.Media.Color" Scope="User">
+      <Value Profile="(Default)">#FF5F5449</Value>
     </Setting>
-    <Setting Name="YellowMouse" Type="System.Windows.Media.Color" Scope="User">
-      <Value Profile="(Default)">#F2FFFF43</Value>
+    <Setting Name="GreyMouse" Type="System.Windows.Media.Color" Scope="User">
+      <Value Profile="(Default)">#F25F5449</Value>
     </Setting>
     <Setting Name="CallUpgrade" Type="System.Boolean" Scope="User">
       <Value Profile="(Default)">True</Value>
@@ -83,23 +83,29 @@
     <Setting Name="ScrollEnabled" Type="System.Boolean" Scope="User">
       <Value Profile="(Default)">False</Value>
     </Setting>
-    <Setting Name="WindowStyle" Type="System.Int16" Scope="User">
-      <Value Profile="(Default)">0</Value>
+    <Setting Name="ShowInterface" Type="System.Boolean" Scope="User">
+      <Value Profile="(Default)">True</Value>
     </Setting>
     <Setting Name="SortPreference" Type="System.Int16" Scope="User">
       <Value Profile="(Default)">0</Value>
     </Setting>
     <Setting Name="PicGallery" Type="System.Byte" Scope="User">
-      <Value Profile="(Default)">2</Value>
+      <Value Profile="(Default)">1</Value>
     </Setting>
     <Setting Name="Slidetimeren" Type="System.Double" Scope="User">
       <Value Profile="(Default)">10000</Value>
     </Setting>
     <Setting Name="Looping" Type="System.Boolean" Scope="User">
-      <Value Profile="(Default)">True</Value>
+      <Value Profile="(Default)">False</Value>
     </Setting>
     <Setting Name="WindowBorderColorEnabled" Type="System.Boolean" Scope="User">
-      <Value Profile="(Default)">False</Value>
+      <Value Profile="(Default)">True</Value>
+    </Setting>
+    <Setting Name="BgColorWhite" Type="System.Boolean" Scope="User">
+      <Value Profile="(Default)">True</Value>
+    </Setting>
+    <Setting Name="FitToWindow" Type="System.Boolean" Scope="User">
+      <Value Profile="(Default)">True</Value>
     </Setting>
   </Settings>
 </SettingsFile>

+ 12 - 12
PicView/lib/AnimationHelper.cs

@@ -113,7 +113,7 @@ namespace PicView.lib
                     ccAnim.From = Settings.Default.Magenta;
                     break;
                 case 12:
-                    ccAnim.From = Settings.Default.Yellow;
+                    ccAnim.From = Settings.Default.Grey;
                     break;
             }
             ccAnim.To = Color.FromArgb(a, r, g, b);
@@ -160,7 +160,7 @@ namespace PicView.lib
                     ccAnim.To = Settings.Default.Magenta;
                     break;
                 case 12:
-                    ccAnim.To = Settings.Default.Yellow;
+                    ccAnim.To = Settings.Default.Grey;
                     break;
             }
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
@@ -216,8 +216,8 @@ namespace PicView.lib
                     ccAnim.To = Settings.Default.MagentaMouse;
                     break;
                 case 12:
-                    ccAnim.From = Settings.Default.Yellow;
-                    ccAnim.To = Settings.Default.YellowMouse;
+                    ccAnim.From = Settings.Default.Grey;
+                    ccAnim.To = Settings.Default.GreyMouse;
                     break;
             }
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
@@ -257,7 +257,7 @@ namespace PicView.lib
                 case 11:
                     return Settings.Default.Magenta;
                 case 12:
-                    return Settings.Default.Yellow;
+                    return Settings.Default.Grey;
 
             }
         }
@@ -290,7 +290,7 @@ namespace PicView.lib
                 case 11:
                     return Settings.Default.MagentaMouse;
                 case 12:
-                    return Settings.Default.YellowMouse;
+                    return Settings.Default.GreyMouse;
             }
         }
 
@@ -370,9 +370,9 @@ namespace PicView.lib
                 case 12:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.YellowMouse.R,
-                        Settings.Default.YellowMouse.G,
-                        Settings.Default.YellowMouse.B);
+                        Settings.Default.GreyMouse.R,
+                        Settings.Default.GreyMouse.G,
+                        Settings.Default.GreyMouse.B);
             }
         }
 
@@ -450,9 +450,9 @@ namespace PicView.lib
                 case 12:
                     return Color.FromArgb(
                         220,
-                        Settings.Default.Yellow.R,
-                        Settings.Default.Yellow.G,
-                        Settings.Default.Yellow.B);
+                        Settings.Default.Grey.R,
+                        Settings.Default.Grey.G,
+                        Settings.Default.Grey.B);
             }
         }
 

+ 22 - 16
PicView/lib/Helper.cs

@@ -3,6 +3,7 @@ using System;
 using System.Diagnostics;
 using System.IO;
 using System.Windows;
+using static PicView.lib.Variables;
 
 namespace PicView.lib
 {
@@ -19,6 +20,27 @@ namespace PicView.lib
             return y == 0 ? x : GCD(y, x % y);
         }
 
+        internal static double GetAspectRatio(bool windowstyle, double width, double height, double monitorSizeWidth, double monitorSizeHeight)
+        {
+            double maxWidth, maxHeight;
+            var interfaceHeight = 93; // TopBar + LowerBar height
+
+            if (windowstyle)
+            {
+                // Get max width and height, based on user's screen
+                maxWidth = Math.Min(monitorSizeWidth - ComfySpace, width);
+                maxHeight = Math.Min((monitorSizeHeight - interfaceHeight), height);
+            }
+            else
+            {
+                // Get max width and height, based on window size
+                maxWidth = Math.Min(monitorSizeWidth, width);
+                maxHeight = Math.Min(monitorSizeHeight - interfaceHeight, height);
+            }
+
+            return Math.Min((maxWidth / width), (maxHeight / height));
+        } 
+
         /// <summary>
         /// Show progress on taskbar
         /// </summary>
@@ -71,22 +93,6 @@ namespace PicView.lib
             p.Start();
         }
 
-        internal static Size GetMonitorSize()
-        {
-            var currentMonitor = System.Windows.Forms.Screen.FromHandle(new System.Windows.Interop.WindowInteropHelper(Application.Current.MainWindow).Handle);
-
-            //find out if our app is being scaled by the monitor
-            PresentationSource source = PresentationSource.FromVisual(Application.Current.MainWindow);
-            double dpiScaling = (source != null && source.CompositionTarget != null ? source.CompositionTarget.TransformFromDevice.M11 : 1);
-
-            //get the available area of the monitor
-            System.Drawing.Rectangle workArea = currentMonitor.WorkingArea;
-            var workAreaWidth = (int)Math.Floor(workArea.Width * dpiScaling);
-            var workAreaHeight = (int)Math.Floor(workArea.Height * dpiScaling);
-
-            return new Size(workAreaWidth, workAreaHeight);
-        }
-
         internal static void SetWindowBorderColor()
         {
             if (Properties.Settings.Default.WindowBorderColorEnabled)

+ 46 - 0
PicView/lib/MonitorSize.cs

@@ -0,0 +1,46 @@
+using System;
+using System.Drawing;
+using System.Windows;
+
+namespace PicView.lib
+{
+
+    internal class MonitorSize
+    {
+        internal int Width { get; set; }
+        internal int Height { get; set; }
+
+        internal double DpiScaling { get; set; }
+
+        internal Rectangle WorkArea { get; set; }
+
+        internal MonitorSize(int width, int height, double dpiScaling, Rectangle workArea)
+        {
+            Width = width;
+            Height = height;
+            DpiScaling = dpiScaling;
+            WorkArea = workArea;
+        }
+
+        internal static MonitorSize GetMonitorSize()
+        {
+            // https://stackoverflow.com/a/32599760
+            var currentMonitor = System.Windows.Forms.Screen.FromHandle(new System.Windows.Interop.WindowInteropHelper(Application.Current.MainWindow).Handle);
+
+            //find out if our app is being scaled by the monitor
+            PresentationSource source = PresentationSource.FromVisual(Application.Current.MainWindow);
+            double dpiScaling = (source != null && source.CompositionTarget != null ? source.CompositionTarget.TransformFromDevice.M11 : 1);
+
+            //get the available area of the monitor
+            Rectangle workArea = currentMonitor.WorkingArea;
+            var workAreaWidth = (int)Math.Floor(workArea.Width * dpiScaling);
+            var workAreaHeight = (int)Math.Floor(workArea.Height * dpiScaling);
+
+            return new MonitorSize(workAreaWidth, workAreaHeight, dpiScaling, workArea);
+        }
+    }
+
+
+
+
+}

+ 0 - 3
PicView/lib/Preloader.cs

@@ -40,10 +40,8 @@ namespace PicView.lib
                 return;
 
             if (File.Exists(Pics[i]))
-            {
                 if (!Contains(Pics[i]))
                     Add(Pics[i]);
-            }
             else
                 Pics.Remove(Pics[i]);
         }
@@ -72,7 +70,6 @@ namespace PicView.lib
 
             var value = Sources[key];
             Sources.TryRemove(key, out value);
-            value = null;
         }
 
         /// <summary>

+ 10 - 0
PicView/lib/Styles/Backgrounds.xaml

@@ -0,0 +1,10 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    
+    <ImageBrush
+        x:Key="NoisyDark"
+        ImageSource="lib/img/noisy-texture-200x200-o4-d31-c-161616-t0.png"
+        TileMode="FlipXY"
+        Viewport="0,0,100,100"
+        ViewportUnits="Absolute" />
+
+</ResourceDictionary>

+ 91 - 81
PicView/lib/Styles/ScrollBar.xaml

@@ -7,14 +7,14 @@
     <Style x:Key="VerticalScrollBarThumbStyle" TargetType="{x:Type Thumb}">
         <Setter Property="IsTabStop" Value="False" />
         <Setter Property="Focusable" Value="False" />
-        <Setter Property="Margin" Value="0,0,2,0" />
+        <Setter Property="MinHeight" Value="50" />
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type Thumb}">
                     <Rectangle
                         Name="ellipse"
-                        Width="11"
-                        Fill="#FF919191" />
+                        Width="30"
+                        Fill="WhiteSmoke" />
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
                             <Setter TargetName="ellipse" Property="Fill" Value="{StaticResource ChosenColorBrush}" />
@@ -42,12 +42,11 @@
                         RadiusY="3.5" />
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
-                            <Setter TargetName="ellipse" Property="Fill" Value="white" />
+                            <Setter TargetName="ellipse" Property="Fill" Value="{StaticResource ChosenColorBrush}" />
                         </Trigger>
                         <Trigger Property="IsDragging" Value="True">
-                            <Setter TargetName="ellipse" Property="Fill" Value="white" />
+                            <Setter TargetName="ellipse" Property="Fill" Value="{StaticResource ChosenColorBrush}" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
@@ -60,17 +59,24 @@
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type RepeatButton}">
                     <Grid
-                        Width="11"
-                        Height="18"
+                        Width="21"
+                        Height="28"
                         Margin="0,0,0,1">
+                        <Grid.Background>
+                            <ImageBrush
+                                ImageSource="/PicView;component/lib/img/noisy-texture-200x200-o4-d30-c-101010-t0.png"
+                                TileMode="FlipXY"
+                                Viewport="0,0,100,100"
+                                ViewportUnits="Absolute" />
+                        </Grid.Background>
                         <Path
                             Name="Path"
-                            Width="13"
-                            Height="13"
+                            Width="18"
+                            Height="18"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Data="M413.1,327.3l-1.8-2.1l-136-156.5c-4.6-5.3-11.5-8.6-19.2-8.6c-7.7,0-14.6,3.4-19.2,8.6L101,324.9l-2.3,2.6  C97,330,96,333,96,336.2c0,8.7,7.4,15.8,16.6,15.8v0h286.8v0c9.2,0,16.6-7.1,16.6-15.8C416,332.9,414.9,329.8,413.1,327.3z"
-                            Fill="#FF919191"
+                            Fill="WhiteSmoke"
                             Stretch="Fill" />
                     </Grid>
                     <ControlTemplate.Triggers>
@@ -92,17 +98,17 @@
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type RepeatButton}">
                     <Grid
-                        Width="11"
-                        Height="18"
+                        Width="21"
+                        Height="28"
                         Margin="0,0,0,0">
                         <Path
                             Name="Path"
-                            Width="13"
-                            Height="13"
+                            Width="18"
+                            Height="18"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             Data="M98.9,184.7l1.8,2.1l136,156.5c4.6,5.3,11.5,8.6,19.2,8.6c7.7,0,14.6-3.4,19.2-8.6L411,187.1l2.3-2.6  c1.7-2.5,2.7-5.5,2.7-8.7c0-8.7-7.4-15.8-16.6-15.8v0H112.6v0c-9.2,0-16.6,7.1-16.6,15.8C96,179.1,97.1,182.2,98.9,184.7z"
-                            Fill="#FF919191"
+                            Fill="WhiteSmoke"
                             Stretch="Fill" />
                     </Grid>
                     <ControlTemplate.Triggers>
@@ -183,94 +189,98 @@
         </Setter>
     </Style>
     <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
-        <Grid Width="23">
-            <Grid.Background>
-                <ImageBrush
-                    ImageSource="/PicView;component/lib/img/noisy-texture-200x200-o4-d30-c-101010-t0.png"
-                    TileMode="FlipXY"
-                    Viewport="0,0,100,100"
-                    ViewportUnits="Absolute" />
-            </Grid.Background>
-            <Grid.RowDefinitions>
-                <RowDefinition MaxHeight="18" />
-                <RowDefinition Height="*" />
-                <RowDefinition MaxHeight="18" />
-            </Grid.RowDefinitions>
-            <RepeatButton
-                Grid.Row="0"
-                Height="18"
-                Command="ScrollBar.LineUpCommand"
-                Style="{StaticResource LineButtonUpStyle}" />
+        <Border
+            Background="#D8141414"
+            BorderBrush="{StaticResource BorderBrush}"
+            BorderThickness="1">
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition MaxHeight="35" />
+                    <RowDefinition Height="*" />
+                    <RowDefinition MaxHeight="35" />
+                </Grid.RowDefinitions>
+                <RepeatButton
+                    Grid.Row="0"
+                    Height="35"
+                    Command="ScrollBar.LineUpCommand"
+                    Style="{StaticResource LineButtonUpStyle}" />
 
-            <Track
-                Name="PART_Track"
-                Grid.Row="1"
-                IsDirectionReversed="True">
-                <Track.DecreaseRepeatButton>
-                    <RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
-                </Track.DecreaseRepeatButton>
-                <Track.Thumb>
-                    <Thumb Style="{StaticResource VerticalScrollBarThumbStyle}" />
-                </Track.Thumb>
-                <Track.IncreaseRepeatButton>
-                    <RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
-                </Track.IncreaseRepeatButton>
-            </Track>
+                <Track
+                    Name="PART_Track"
+                    Grid.Row="1"
+                    IsDirectionReversed="True">
+                    <Track.DecreaseRepeatButton>
+                        <RepeatButton Command="ScrollBar.PageUpCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
+                    </Track.DecreaseRepeatButton>
+                    <Track.Thumb>
+                        <Thumb Style="{StaticResource VerticalScrollBarThumbStyle}" />
+                    </Track.Thumb>
+                    <Track.IncreaseRepeatButton>
+                        <RepeatButton Command="ScrollBar.PageDownCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
+                    </Track.IncreaseRepeatButton>
+                </Track>
 
-            <RepeatButton
-                Grid.Row="2"
-                Height="18"
-                Command="ScrollBar.LineDownCommand"
-                Style="{StaticResource LineButtonDownStyle}" />
-        </Grid>
+                <RepeatButton
+                    Grid.Row="2"
+                    Height="35"
+                    Command="ScrollBar.LineDownCommand"
+                    Style="{StaticResource LineButtonDownStyle}" />
+            </Grid>
+        </Border>
     </ControlTemplate>
     <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
-        <Grid Background="#D8141414">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition MaxWidth="18" />
-                <ColumnDefinition Width="*" />
-                <ColumnDefinition MaxWidth="18" />
-            </Grid.ColumnDefinitions>
-            <RepeatButton
+        <Border
+            Background="#D8141414"
+            BorderBrush="{StaticResource BorderBrush}"
+            BorderThickness="0,1,0,0">
+            <Grid>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition MaxWidth="18" />
+                    <ColumnDefinition Width="*" />
+                    <ColumnDefinition MaxWidth="18" />
+                </Grid.ColumnDefinitions>
+                <RepeatButton
                 Grid.Column="0"
                 Width="18"
                 Command="ScrollBar.LineLeftCommand"
                 Style="{StaticResource LineButtonLeftStyle}" />
 
-            <Track
+                <Track
                 Name="PART_Track"
                 Grid.Column="1"
                 IsDirectionReversed="False">
-                <Track.DecreaseRepeatButton>
-                    <RepeatButton Command="ScrollBar.PageLeftCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
-                </Track.DecreaseRepeatButton>
-                <Track.Thumb>
-                    <Thumb Style="{StaticResource HorizontalScrollBarThumbStyle}" />
-                </Track.Thumb>
-                <Track.IncreaseRepeatButton>
-                    <RepeatButton Command="ScrollBar.PageRightCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
-                </Track.IncreaseRepeatButton>
-                <Track.Resources>
-                    <!--  Thumb's minimum height is half of this metric  -->
-                    <system:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">
-                        90
-                    </system:Double>
-                </Track.Resources>
-            </Track>
-            <RepeatButton
+                    <Track.DecreaseRepeatButton>
+                        <RepeatButton Command="ScrollBar.PageLeftCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
+                    </Track.DecreaseRepeatButton>
+                    <Track.Thumb>
+                        <Thumb Style="{StaticResource HorizontalScrollBarThumbStyle}" />
+                    </Track.Thumb>
+                    <Track.IncreaseRepeatButton>
+                        <RepeatButton Command="ScrollBar.PageRightCommand" Style="{StaticResource ScrollBarPageButtonStyle}" />
+                    </Track.IncreaseRepeatButton>
+                    <Track.Resources>
+                        <!--  Thumb's minimum height is half of this metric  -->
+                        <system:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">
+                            90
+                        </system:Double>
+                    </Track.Resources>
+                </Track>
+                <RepeatButton
                 Grid.Column="2"
                 Width="18"
                 Command="ScrollBar.LineRightCommand"
                 Style="{StaticResource LineButtonRightStyle}" />
-        </Grid>
+            </Grid>
+        </Border>
     </ControlTemplate>
     <Style TargetType="{x:Type ScrollBar}">
         <Setter Property="SnapsToDevicePixels" Value="True" />
         <Setter Property="OverridesDefaultStyle" Value="true" />
         <Style.Triggers>
             <Trigger Property="Orientation" Value="Vertical">
-                <Setter Property="Width" Value="18" />
+                <Setter Property="Width" Value="30" />
                 <Setter Property="Height" Value="Auto" />
+                <Setter Property="MinHeight" Value="25" />
                 <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
             </Trigger>
             <Trigger Property="Orientation" Value="Horizontal">

+ 26 - 19
PicView/lib/UserControls/CustomControls/PicGallery.xaml

@@ -8,22 +8,29 @@
     d:DesignHeight="300"
     d:DesignWidth="300"
     mc:Ignorable="d">
-    <Grid x:Name="grid" Background="{StaticResource BackgroundColorBrushFade}">
-        <UserControls:X2
-            x:Name="x2"
-            HorizontalAlignment="Right"
-            VerticalAlignment="Top" />
-        <ScrollViewer
-            x:Name="Scroller"
-            Margin="0,60,0,0"
-            HorizontalScrollBarVisibility="Visible"
-            VerticalScrollBarVisibility="Disabled">
-            <WrapPanel
-                x:Name="Container"
-                VerticalAlignment="Center"
-                Background="Transparent"
-                Orientation="Vertical"
-                VirtualizingPanel.VirtualizationMode="Recycling" />
-        </ScrollViewer>
-    </Grid>
-</UserControl>
+    <Border
+        x:Name="border"
+        Background="{StaticResource BackgroundColorBrushFade}"
+        BorderBrush="{StaticResource BorderBrush}"
+        BorderThickness="1">
+        <Grid x:Name="grid">
+            <UserControls:X2
+                x:Name="x2"
+                HorizontalAlignment="Right"
+                VerticalAlignment="Top" />
+            <ScrollViewer
+                x:Name="Scroller"
+                FocusVisualStyle="{x:Null}"
+                Focusable="False"
+                HorizontalScrollBarVisibility="Visible"
+                VerticalScrollBarVisibility="Disabled">
+                <WrapPanel
+                    x:Name="Container"
+                    VerticalAlignment="Center"
+                    Background="Transparent"
+                    Orientation="Vertical"
+                    VirtualizingPanel.VirtualizationMode="Recycling" />
+            </ScrollViewer>
+        </Grid>
+    </Border>
+</UserControl>

+ 206 - 108
PicView/lib/UserControls/CustomControls/PicGallery.xaml.cs

@@ -1,4 +1,5 @@
 using System;
+using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Windows;
@@ -7,7 +8,6 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Animation;
 using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
 using System.Windows.Threading;
 using static PicView.lib.ImageManager;
 using static PicView.lib.Variables;
@@ -19,9 +19,14 @@ namespace PicView.lib.UserControls
     /// </summary>
     public partial class PicGallery : UserControl
     {
+        #region Constructor, variables, loaded
+
         public bool LoadComplete, isLoading, open;
+
         public event MyEventHandler PreviewItemClick, ItemClick;
-        int current_page, total_pages, items_per_page, horizontal_items, vertical_items;
+
+        private int current_page, total_pages, items_per_page, horizontal_items, vertical_items;
+
         const int picGalleryItem_Size = 230;
 
         //int next_page
@@ -43,12 +48,26 @@ namespace PicView.lib.UserControls
         {
             InitializeComponent();
             Loaded += PicGallery_Loaded;
+        }
+
+        private void PicGallery_Loaded(object sender, RoutedEventArgs e)
+        {
+            Scroller.PreviewMouseWheel += Scroller_MouseWheel;
+            Scroller.MouseDown += (s,x) => Application.Current.MainWindow.Focus();
             x2.MouseLeftButtonUp += X2_MouseLeftButtonUp;
+            grid.MouseLeftButtonDown += (s,x) => Application.Current.MainWindow.Focus();
+            
+            LoadComplete = isLoading = open = false;
         }
 
+        #endregion
+
+        #region animations
+
         private void X2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         {
-            FadeOut();
+            if (Properties.Settings.Default.PicGallery == 1)
+                FadeOut();
         }
 
         private void FadeOut()
@@ -64,80 +83,37 @@ namespace PicView.lib.UserControls
                 open = false;
                 Visibility = Visibility.Collapsed;
             };
-            BeginAnimation(UIElement.OpacityProperty, da);
+            BeginAnimation(OpacityProperty, da);
         }
 
-        private void PicGallery_Loaded(object sender, RoutedEventArgs e)
-        {
-            Scroller.PreviewMouseWheel += Scroller_MouseWheel;
-        }
-
-        private void Scroller_MouseWheel(object sender, MouseWheelEventArgs e)
-        {
-            e.Handled = true;
-            ScrollTo(e.Delta > 0);
-        }
+        #endregion
 
         internal void Calculate_Paging()
         {
-            horizontal_items = (int)Math.Ceiling(Width / picGalleryItem_Size);
-            vertical_items = (int)Math.Ceiling(Container.ActualHeight / picGalleryItem_Size);
-            items_per_page = horizontal_items * vertical_items;
-            total_pages = (int)Math.Floor((double)Pics.Count / items_per_page);
-            current_page = (int)Math.Floor((double)FolderIndex / items_per_page);
-
-            //if (!string.IsNullOrWhiteSpace(PagingText.Text))
-            //    PagingText.Text = "";
-
-            //for (int i = 0; i < total_pages; i++)
-            //{
-            //    if (i > 5 && i < (total_pages - 1))
-            //        continue;
-            //    PagingText.Text += i;
-            //    PagingText.Text += " ";
-            //}
-            //ScrollTo();
-        }
-
+            if (Container.ActualHeight == 0)
+                return;
 
-        /// <summary>
-        /// Scrolls a page back or forth
-        /// </summary>
-        /// <param name="next"></param>
-        /// <param name="end"></param>
-        internal void ScrollTo(bool next, bool end = false)
-        {
-            if (end)
+            if (Properties.Settings.Default.PicGallery == 1)
             {
-                if (next)
-                    Scroller.ScrollToRightEnd();
-                else
-                    Scroller.ScrollToLeftEnd();
+                horizontal_items = (int)Math.Ceiling(Width / picGalleryItem_Size);
+                vertical_items = (int)Math.Ceiling(Container.ActualHeight / picGalleryItem_Size);
+                items_per_page = horizontal_items * vertical_items;
+                total_pages = (int)Math.Floor((double)Pics.Count / items_per_page);
+                current_page = (int)Math.Floor((double)FolderIndex / items_per_page);
+                return;
             }
-            else
-            {
-                if (next)
-                    Scroller.ScrollToHorizontalOffset(Scroller.HorizontalOffset - picGalleryItem_Size);
-                else
-                    Scroller.ScrollToHorizontalOffset(Scroller.HorizontalOffset + picGalleryItem_Size);
-            }
-        }
 
-        /// <summary>
-        /// Scrolls to center of current item
-        /// </summary>
-        /// <param name="item">The index of picGalleryItem</param>
-        internal void ScrollTo()
-        {
-            var x = (picGalleryItem_Size * horizontal_items) * current_page;
-            Scroller.ScrollToHorizontalOffset(x);
+            vertical_items = Pics.Count;
+            items_per_page = (int)Math.Floor(Height / picGalleryItem_Size);
+            total_pages = (int)Math.Floor((double)Pics.Count / items_per_page);
+            current_page = (int)Math.Floor((double)FolderIndex / items_per_page);
         }
 
-        async void Add(BitmapSource pic, string file, int index)
+        private async void Add(BitmapSource pic, int index)
         {
             await Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
             {
-                var item = new PicGalleryItem(pic, file);
+                var item = new PicGalleryItem(pic);
                 item.MouseLeftButtonUp += (s, x) => Click(index);
                 Container.Children.Add(item);
             }));
@@ -150,16 +126,18 @@ namespace PicView.lib.UserControls
             {
                 for (int i = 0; i < Pics.Count; i++)
                 {
-                    var file = Pics[i];
-                    var pic = GetBitmapSourceThumb(file);
+                    var pic = GetBitmapSourceThumb(Pics[i]);
                     if (pic != null)
                     {
                         pic.Freeze();
-                        Add(pic, file, i);
+                        Add(pic, i);
                     }
 
                     if (i == Pics.Count - 1)
+                    {
                         LoadComplete = true;
+                        isLoading = false;
+                    }
                 }
             });
             t.Start();
@@ -178,69 +156,190 @@ namespace PicView.lib.UserControls
 
         internal void Click(int id)
         {
+            Application.Current.MainWindow.Focus();
             PreviewItemClick(this, new MyEventArgs(id, null));
-            var img = new Image()
+
+            if (Properties.Settings.Default.PicGallery == 1)
             {
-                Source = GetBitmapSourceThumb(Pics[id]),
-                Stretch = Stretch.Fill,
-                HorizontalAlignment = HorizontalAlignment.Center,
-                VerticalAlignment = VerticalAlignment.Center
-            };
-            var border = new Border()
+                var img = new Image()
+                {
+                    Source = GetBitmapSourceThumb(Pics[id]),
+                    Stretch = Stretch.Fill,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Center
+                };
+                var border = new Border()
+                {
+                    BorderThickness = new Thickness(1),
+                    BorderBrush = (SolidColorBrush)Application.Current.Resources["BorderBrush"],
+                    Background = (SolidColorBrush)Application.Current.Resources["BackgroundColorBrush"]
+                };
+                border.Child = img;
+                grid.Children.Add(border);
+
+                var from = picGalleryItem_Size;
+                var to = new double[] { Application.Current.MainWindow.ActualWidth - 15, Application.Current.MainWindow.ActualHeight - 95 };
+
+                var da = new DoubleAnimation
+                {
+                    From = from,
+                    To = to[0],
+                    Duration = TimeSpan.FromSeconds(.3),
+                    AccelerationRatio = 0.2,
+                    DecelerationRatio = 0.4
+                };
+
+                var da0 = new DoubleAnimation
+                {
+                    From = from,
+                    To = to[1],
+                    Duration = TimeSpan.FromSeconds(.3),
+                    AccelerationRatio = 0.2,
+                    DecelerationRatio = 0.4
+                };
+
+                da.Completed += delegate
+                {
+                    ItemClick(this, new MyEventArgs(id, img.Source));
+                    grid.Children.Remove(border);
+                    Visibility = Visibility.Collapsed;
+                    picGallery.open = false;
+                };
+
+                img.BeginAnimation(WidthProperty, da);
+                img.BeginAnimation(HeightProperty, da0);
+            }
+            else
             {
-                BorderThickness = new Thickness(1),
-                BorderBrush = (SolidColorBrush)Application.Current.Resources["BorderBrush"],
-                Background = (SolidColorBrush)Application.Current.Resources["BackgroundColorBrush"]
-            };
-            border.Child = img;
-            grid.Children.Add(border);
-            var from = 230; // 230 = PicGalleryItem size
-            //var to = new double[] { Width, Height };
-            var to = new double[] { Application.Current.MainWindow.ActualWidth - 15, Application.Current.MainWindow.ActualHeight - 95 };
-            //var to = new double[] { Application.Current.MainWindow.Width, Application.Current.MainWindow.Height};
-            var da = new DoubleAnimation();
-            da.From = from;
-            da.To = to[0]; // Width
-            da.Duration = TimeSpan.FromSeconds(.3);
-            da.AccelerationRatio = 0.2;
-            da.DecelerationRatio = 0.4;
-
-            var da0 = new DoubleAnimation();
-            da0.From = from;
-            da0.To = to[1]; // Height
-            da0.Duration = TimeSpan.FromSeconds(.3);
-            da0.AccelerationRatio = 0.2;
-            da0.DecelerationRatio = 0.4;
+                ItemClick(this, new MyEventArgs(id, GetBitmapSourceThumb(Pics[id])));
+            }
+            Application.Current.MainWindow.Focus();
+        }
 
-            da.Completed += delegate
+        #region Scroll
+
+        private void Scroller_MouseWheel(object sender, MouseWheelEventArgs e)
+        {
+            e.Handled = true;
+            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
+                ScrollTo(e.Delta > 0, true);
+            else
+                ScrollTo(e.Delta > 0);
+        }
+
+        /// <summary>
+        /// Scrolls a page back or forth
+        /// </summary>
+        /// <param name="next"></param>
+        /// <param name="end"></param>
+        internal void ScrollTo(bool next, bool end = false, bool animate = false)
+        {
+            if (end)
             {
-                ItemClick(this, new MyEventArgs(id, img.Source));
-                grid.Children.Remove(border);
-                Visibility = Visibility.Collapsed;
-                picGallery.open = false;
-            };
+                if (next)
+                    Scroller.ScrollToRightEnd();
+                else
+                    Scroller.ScrollToLeftEnd();
+            }
+            else
+            {
+                var direction = next ? Scroller.HorizontalOffset + picGalleryItem_Size : Scroller.HorizontalOffset - picGalleryItem_Size;
 
+                if (Properties.Settings.Default.PicGallery == 1)
+                {
+                    if (animate)
+                    {
+                        //var anim = new DoubleAnimation
+                        //{
+                        //    From = Scroller.HorizontalOffset,
+                        //    To = direction,
+                        //    Duration = TimeSpan.FromSeconds(.3),
+                        //    AccelerationRatio = 0.2,
+                        //    DecelerationRatio = 0.4
+                        //};
 
-            img.BeginAnimation(Rectangle.WidthProperty, da);
-            img.BeginAnimation(Rectangle.HeightProperty, da0);
+                        //var sb = new Storyboard();
+                        //sb.Children.Add(anim);
+                        //Storyboard.SetTarget(anim, Scroller);
+                        //Storyboard.SetTargetProperty(anim, new PropertyPath(ScrollAnimationBehavior.VerticalOffsetProperty))
+                    }
+                    else
+                    {
+                        if (next)
+                            Scroller.ScrollToHorizontalOffset(direction);
+                        else
+                            Scroller.ScrollToHorizontalOffset(direction);
+                    }
+
+                }
+                else
+                {
+                    if (animate)
+                    {
+                        //DoubleAnimation verticalAnimation = new DoubleAnimation
+                        //{
+                        //    From = scrollViewer.VerticalOffset,
+                        //    To = some
+                        //};
+                        //value;
+                        //verticalAnimation.Duration = new Duration(some duration);
+
+                        //Storyboard storyboard = new Storyboard();
+
+                        //storyboard.Children.Add(verticalAnimation);
+                        //Storyboard.SetTarget(verticalAnimation, scrollViewer);
+                        //Storyboard.SetTargetProperty(verticalAnimation, new PropertyPath(ScrollAnimationBehavior.VerticalOffsetProperty)); // Attached dependency property
+                        //storyboard.Begin();
+                    }
+                    else
+                    {
+                        if (next)
+                            Scroller.ScrollToVerticalOffset(Scroller.VerticalOffset - picGalleryItem_Size); 
+                        else
+                            Scroller.ScrollToVerticalOffset(Scroller.VerticalOffset + picGalleryItem_Size);
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// Scrolls to center of current item
+        /// </summary>
+        /// <param name="item">The index of picGalleryItem</param>
+        internal void ScrollTo()
+        {
+            if (Properties.Settings.Default.PicGallery == 1)
+            {
+                var x = (picGalleryItem_Size * horizontal_items) * current_page;
+                Scroller.ScrollToHorizontalOffset(x);
+                return;
+            }
+
+            if (vertical_items != 0)
+            {
+                var y = (picGalleryItem_Size * Pics.Count) * current_page;
+                Scroller.ScrollToVerticalOffset(y);
+            }
         }
-    }
 
+        #endregion Scroll
+    }
 
     // Event
 
     public delegate void MyEventHandler(object source, MyEventArgs e);
 
-
     public class MyEventArgs : EventArgs
     {
         private int Id;
         private ImageSource img;
+
         public MyEventArgs(int Id, ImageSource img)
         {
             this.Id = Id;
             this.img = img;
         }
+
         public int GetId()
         {
             return Id;
@@ -251,5 +350,4 @@ namespace PicView.lib.UserControls
             return img;
         }
     }
-
-}
+}

+ 12 - 2
PicView/lib/UserControls/CustomControls/PicGalleryItem.xaml

@@ -6,19 +6,29 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     d:DesignHeight="300"
     d:DesignWidth="300"
+    FocusVisualStyle="{x:Null}"
+    Focusable="False"
     mc:Ignorable="d">
-    <Border Width="230" Height="230">
+    <Border
+        Width="230"
+        Height="230"
+        FocusVisualStyle="{x:Null}"
+        Focusable="False">
         <Border
             x:Name="border"
             Width="200"
             Height="200"
             Background="{StaticResource BackgroundColorBrushAlt}"
             BorderBrush="{StaticResource BorderBrush}"
-            BorderThickness="1">
+            BorderThickness="1"
+            FocusVisualStyle="{x:Null}"
+            Focusable="False">
             <Image
                 x:Name="img"
                 HorizontalAlignment="Center"
                 VerticalAlignment="Center"
+                FocusVisualStyle="{x:Null}"
+                Focusable="False"
                 Stretch="UniformToFill" />
         </Border>
     </Border>

+ 3 - 4
PicView/lib/UserControls/CustomControls/PicGalleryItem.xaml.cs

@@ -10,10 +10,9 @@ namespace PicView.lib.UserControls
     /// </summary>
     public partial class PicGalleryItem : UserControl
     {
-        public PicGalleryItem(BitmapSource pic, string file)
+        public PicGalleryItem(BitmapSource pic)
         {
             InitializeComponent();
-            var x = Path.GetFileName(file);
 
             img.Source = pic;
 
@@ -31,12 +30,12 @@ namespace PicView.lib.UserControls
             );
 
             img.MouseLeftButtonUp += Img_MouseLeftButtonUp;
-
         }
 
         private void Img_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         {
-            AnimationHelper.HoverSizeAnim(border, false, 230, 1000);
+            if (Properties.Settings.Default.PicGallery == 1)
+                AnimationHelper.HoverSizeAnim(border, false, 230, 1000);
         }
     }
 }

+ 22 - 0
PicView/lib/UserControls/Menus/FunctionsMenu.xaml

@@ -277,6 +277,28 @@
                         </Canvas>
                     </Button>
 
+                    <Button
+                        x:Name="BgButton"
+                        Width="42"
+                        Height="42"
+                        Margin="0,0,4,0"
+                        Style="{StaticResource MetroAlphaFlatButton}"
+                        ToolTip="Change between white and transparent background for images">
+                        <Canvas>
+                            <Path
+                                Canvas.Left="-13"
+                                Canvas.Top="-15"
+                                Width="28"
+                                Height="30"
+                                Data="M424 64H88c-26.6 0-48 21.6-48 48v288c0 26.4 21.4 48 48 48h336c26.4 0 48-21.6 48-48V112c0-26.4-21.4-48-48-48zm0 336H88V176h336v224z"
+                                Stretch="Fill">
+                                <Path.Fill>
+                                    <SolidColorBrush x:Name="BgBrush" Color="{StaticResource MainColor}" />
+                                </Path.Fill>
+                            </Path>
+                        </Canvas>
+                    </Button>
+
                 </WrapPanel>
             </Canvas>
         </Border>

+ 35 - 0
PicView/lib/UserControls/Menus/FunctionsMenu.xaml.cs

@@ -63,6 +63,11 @@ namespace PicView.lib.UserControls.Menus
             SlideshowButton.MouseLeave += SlideshowButtonMouseLeave;
             SlideshowButton.PreviewMouseLeftButtonDown += SlideshowButtonMouseButtonDown;
 
+            //SlideshowButton
+            BgButton.MouseEnter += BgButtonMouseOver;
+            BgButton.MouseLeave += BgButtonMouseLeave;
+            BgButton.PreviewMouseLeftButtonDown += BgButtonMouseButtonDown;
+
         }
 
         #region Mouseover Events
@@ -326,6 +331,36 @@ namespace PicView.lib.UserControls.Menus
                 false
             );
         }
+
+        //Bg Button
+        private void BgButtonMouseOver(object sender, MouseEventArgs e)
+        {
+            AnimationHelper.MouseEnterColorEvent(
+                mainColor.A,
+                mainColor.R,
+                mainColor.G,
+                mainColor.B,
+                BgBrush,
+                false
+            );
+        }
+
+        private void BgButtonMouseButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            AnimationHelper.PreviewMouseLeftButtonDownColorEvent(BgBrush, false);
+        }
+
+        private void BgButtonMouseLeave(object sender, MouseEventArgs e)
+        {
+            AnimationHelper.MouseLeaveColorEvent(
+                mainColor.A,
+                mainColor.R,
+                mainColor.G,
+                mainColor.B,
+                BgBrush,
+                false
+            );
+        }
         #endregion
     }
 }

+ 5 - 0
PicView/lib/Variables.cs

@@ -163,6 +163,11 @@ namespace PicView.lib
         /// </summary>
         internal static int Rotateint { get; set; }
 
+        /// <summary>
+        /// Used to get and set monitor size
+        /// </summary>
+        internal static MonitorSize MonitorInfo { get; set; }
+
         // UserControls
         internal static ImageSettings imageSettingsMenu;
         internal static FileMenu fileMenu;

+ 26 - 19
PicView/lib/Windows/AllSettings.xaml

@@ -9,6 +9,7 @@
     Foreground="{StaticResource MainColorBrush}"
     ResizeMode="NoResize"
     ShowInTaskbar="False"
+    SizeToContent="WidthAndHeight"
     TextOptions.TextFormattingMode="Display"
     TextOptions.TextRenderingMode="ClearType"
     WindowStartupLocation="CenterOwner"
@@ -16,12 +17,13 @@
 
 
     <Border
+        x:Name="WindowBorderBrush"
         Width="450"
-        Height="490"
+        MaxHeight="700"
         BorderBrush="{StaticResource ChosenColorBrush}"
         BorderThickness="1">
 
-        <Grid>
+        <StackPanel>
             <Canvas
                 Height="34"
                 VerticalAlignment="Top"
@@ -102,24 +104,20 @@
 
             </Canvas>
 
-            <Canvas Width="449" Height="420">
+            <Grid>
                 <Rectangle
                     x:Name="LeftBorderRectangle"
                     Width="7"
-                    Height="420"
+                    HorizontalAlignment="Left"
                     Fill="{StaticResource BackgroundColorBrushAltW}" />
                 <Rectangle
                     x:Name="RightBorderRectangle"
-                    Canvas.Left="441"
-                    Canvas.Top="-1"
                     Width="7"
-                    Height="421"
+                    HorizontalAlignment="Right"
                     Fill="{StaticResource BackgroundColorBrushAltW}" />
                 <ScrollViewer
                     x:Name="Scroller"
                     Width="436"
-                    Height="421"
-                    Margin="6,-1,0,0"
                     Background="{StaticResource BackgroundColorBrushAlt}"
                     HorizontalScrollBarVisibility="Disabled"
                     VerticalScrollBarVisibility="Auto">
@@ -257,15 +255,15 @@
                                 </RadioButton.Background>
                             </RadioButton>
                             <RadioButton
-                                x:Name="YellowRadio"
+                                x:Name="GreyRadio"
                                 Width="100"
                                 Height="40"
                                 Margin="5,3"
                                 BorderBrush="{StaticResource BorderBrushAlt}"
                                 BorderThickness="1"
-                                Content="Yellow">
+                                Content="Grey">
                                 <RadioButton.Background>
-                                    <SolidColorBrush x:Name="YellowBrush" Color="{StaticResource BackgroundColorFade}" />
+                                    <SolidColorBrush x:Name="GreyBrush" Color="{StaticResource BackgroundColorFade}" />
                                 </RadioButton.Background>
                             </RadioButton>
                             <RadioButton
@@ -329,7 +327,7 @@
                                 Content="Enable Window Color Brush"
                                 Style="{StaticResource Checkstyle}">
                                 <CheckBox.Background>
-                                    <SolidColorBrush x:Name="BorderBrush" Color="{StaticResource BackgroundColorFade}" />
+                                    <SolidColorBrush x:Name="BorderBrushColor" Color="{StaticResource BackgroundColorFade}" />
                                 </CheckBox.Background>
                             </CheckBox>
                         </WrapPanel>
@@ -337,11 +335,11 @@
                             Margin="0,3,0,0"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
-                            Content="Slideshow Timer"
+                            Content="Set the slideshow timer"
                             Foreground="{StaticResource MainColorBrush}" />
                         <WrapPanel
                             Width="332"
-                            Margin="0,3,0,8"
+                            Margin="0,3,0,10"
                             HorizontalAlignment="Center"
                             VerticalAlignment="Top"
                             Orientation="Horizontal">
@@ -359,18 +357,27 @@
                                 Width="30"
                                 Margin="5,3"
                                 HorizontalAlignment="Right"
+                                FontFamily="/PicView;component/lib/fonts/#TeX Gyre Heros"
+                                FontSize="15"
                                 IsReadOnly="True"
-                                ToolTip="0 = 0.5 Sec - 15 = 15 Sec." />
+                                Text="1"
+                                TextAlignment="Center"
+                                ToolTip="Enter the slideshow amount in seconds." />
 
                             <Label Content="Sec." />
 
                         </WrapPanel>
 
-                        <TextBlock Margin="0,5" TextAlignment="Center">Some settings may require restart to take effect</TextBlock>
+                        <TextBlock
+                            Margin="0,5"
+                            FontStyle="Italic"
+                            TextAlignment="Center">
+                            Color effects require a restart to take effect
+                        </TextBlock>
                     </StackPanel>
                 </ScrollViewer>
 
-            </Canvas>
+            </Grid>
             <Border
                 Height="35"
                 VerticalAlignment="Bottom"
@@ -383,7 +390,7 @@
                     FontSize="14"
                     FontStyle="Italic" />
             </Border>
-        </Grid>
+        </StackPanel>
 
 
 

+ 17 - 17
PicView/lib/Windows/AllSettings.xaml.cs

@@ -92,11 +92,11 @@ namespace PicView.Windows
                 MagentaRadio.MouseLeave += MagentaRadio_MouseLeave;
                 MagentaRadio.Click += Magenta;
 
-                // YellowRadio
-                YellowRadio.PreviewMouseLeftButtonDown += YellowRadio_PreviewMouseLeftButtonDown;
-                YellowRadio.MouseEnter += YellowRadio_MouseEnter;
-                YellowRadio.MouseLeave += YellowRadio_MouseLeave;
-                YellowRadio.Click += Yellow;
+                // GreyRadio
+                GreyRadio.PreviewMouseLeftButtonDown += GreyRadio_PreviewMouseLeftButtonDown;
+                GreyRadio.MouseEnter += GreyRadio_MouseEnter;
+                GreyRadio.MouseLeave += GreyRadio_MouseLeave;
+                GreyRadio.Click += Grey;
 
                 // LoopRadio
                 LoopRadio.PreviewMouseLeftButtonDown += LoopRadio_PreviewMouseLeftButtonDown;
@@ -162,7 +162,7 @@ namespace PicView.Windows
                         MagentaRadio.IsChecked = true;
                         break;
                     case 12:
-                        YellowRadio.IsChecked = true;
+                        GreyRadio.IsChecked = true;
                         break;
                 }
 
@@ -535,34 +535,34 @@ namespace PicView.Windows
             AnimationHelper.PreviewMouseLeftButtonDownColorEvent(MagentaBrush, 11);
         }
 
-        // Yellow
-        void YellowRadio_MouseLeave(object sender, MouseEventArgs e)
+        // Grey
+        void GreyRadio_MouseLeave(object sender, MouseEventArgs e)
         {
             AnimationHelper.MouseLeaveColorEvent(
                 backgroundBorderColor.A,
                 backgroundBorderColor.R,
                 backgroundBorderColor.G,
                 backgroundBorderColor.B,
-                YellowBrush,
+                GreyBrush,
                 12
             );
         }
 
-        void YellowRadio_MouseEnter(object sender, MouseEventArgs e)
+        void GreyRadio_MouseEnter(object sender, MouseEventArgs e)
         {
             AnimationHelper.MouseEnterColorEvent(
                 backgroundBorderColor.A,
                 backgroundBorderColor.R,
                 backgroundBorderColor.G,
                 backgroundBorderColor.B,
-                YellowBrush,
+                GreyBrush,
                 12
             );
         }
 
-        void YellowRadio_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        void GreyRadio_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
-            AnimationHelper.PreviewMouseLeftButtonDownColorEvent(YellowBrush, 12);
+            AnimationHelper.PreviewMouseLeftButtonDownColorEvent(GreyBrush, 12);
         }
 
         // Loop
@@ -633,7 +633,7 @@ namespace PicView.Windows
                 backgroundBorderColor.R,
                 backgroundBorderColor.G,
                 backgroundBorderColor.B,
-                BorderBrush,
+                BorderBrushColor,
                 false
             );
         }
@@ -645,14 +645,14 @@ namespace PicView.Windows
                 backgroundBorderColor.R,
                 backgroundBorderColor.G,
                 backgroundBorderColor.B,
-                BorderBrush,
+                BorderBrushColor,
                 false
             );
         }
 
         void BorderRadio_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
-            AnimationHelper.MouseLeaveColorEvent(0, 0, 0, 0, BorderBrush, false);
+            AnimationHelper.MouseLeaveColorEvent(0, 0, 0, 0, BorderBrushColor, false);
         }
 
         #endregion
@@ -714,7 +714,7 @@ namespace PicView.Windows
             Properties.Settings.Default.ColorTheme = 11;
         }
 
-        private static void Yellow(object sender, RoutedEventArgs e)
+        private static void Grey(object sender, RoutedEventArgs e)
         {
             Properties.Settings.Default.ColorTheme = 12;
         }

+ 6 - 3
PicView/lib/Windows/FakeWindow.xaml

@@ -5,14 +5,17 @@
     Title="FakeWindow"
     AllowsTransparency="True"
     Background="#72000000"
+    Focusable="False"
     ResizeMode="NoResize"
     ShowInTaskbar="False"
     Topmost="False"
     WindowStartupLocation="CenterScreen"
-    WindowStyle="None"
-    Width="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenWidthKey}}" Height="{DynamicResource {x:Static SystemParameters.MaximizedPrimaryScreenHeightKey}}">
+    WindowStyle="None">
     <WindowChrome.WindowChrome>
         <WindowChrome CaptionHeight="0" UseAeroCaptionButtons="False" />
     </WindowChrome.WindowChrome>
-    <Grid x:Name="grid" />
+    <Grid
+        x:Name="grid"
+        FocusVisualStyle="{x:Null}"
+        Focusable="False" />
 </Window>

+ 17 - 10
PicView/lib/Windows/FakeWindow.xaml.cs

@@ -3,8 +3,8 @@ using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
-using static PicView.lib.Variables;
 using static PicView.lib.Helper;
+using static PicView.lib.Variables;
 
 namespace PicView.Windows
 {
@@ -16,19 +16,26 @@ namespace PicView.Windows
         public FakeWindow()
         {
             InitializeComponent();
-            var monitorSize = GetMonitorSize();
-            Width = monitorSize.Width;
-            Height = monitorSize.Height;
-            Width = monitorSize.Width;
-            Height = monitorSize.Height;
+            Width = MonitorInfo.Width;
+            Height = MonitorInfo.Height;
+            Width = MonitorInfo.Width;
+            Height = MonitorInfo.Height;
+            ContentRendered += FakeWindow_ContentRendered;
+
+        }
+
+        private void FakeWindow_ContentRendered(object sender, EventArgs e)
+        {
             MouseLeftButtonDown += FakeWindow_MouseLeftButtonDown;
+            MouseRightButtonDown += FakeWindow_MouseLeftButtonDown;
             Application.Current.MainWindow.StateChanged += MainWindow_StateChanged;
             MouseWheel += FakeWindow_MouseWheel;
+            Application.Current.MainWindow.Focus();
         }
 
         private void FakeWindow_MouseWheel(object sender, MouseWheelEventArgs e)
         {
-            
+            picGallery.ScrollTo(e.Delta > 0);
         }
 
         private void MainWindow_StateChanged(object sender, EventArgs e)
@@ -37,6 +44,7 @@ namespace PicView.Windows
             {
                 case WindowState.Normal:
                     Show();
+                    Application.Current.MainWindow.Focus();
                     break;
 
                 case WindowState.Minimized:
@@ -59,9 +67,7 @@ namespace PicView.Windows
         public void AddGallery()
         {
             if (grid.Children.Contains(picGallery))
-            {
                 return;
-            }
 
             picGallery.Width = 250;
             picGallery.Height = SystemParameters.WorkArea.Height;
@@ -75,7 +81,8 @@ namespace PicView.Windows
             picGallery.x2.Visibility = Visibility.Collapsed;
             picGallery.Scroller.Margin = new Thickness(0);
             picGallery.Background = new SolidColorBrush(Colors.Transparent);
-            grid.Children.Add(picGallery);
+            if (!grid.Children.Contains(picGallery))
+                grid.Children.Add(picGallery);
         }
     }
 }

部分文件因为文件数量过多而无法显示