├── README.md
├── .gitattributes
├── Source
├── General
│ └── HeBianGu.General.ImageCore
│ │ ├── nuget-package.bat
│ │ ├── nuget-push.bat
│ │ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ │ ├── Themes
│ │ ├── Generic.xaml
│ │ └── Default.xaml
│ │ ├── Provider
│ │ ├── Mark
│ │ │ ├── LoactionArgs.cs
│ │ │ ├── IndicatorObject.cs
│ │ │ └── MaskCanvas.cs
│ │ ├── OperateType.cs
│ │ ├── Rectangle
│ │ │ ├── RectangleLayer.cs
│ │ │ ├── IRectangleStroke.cs
│ │ │ └── RectangleShape.cs
│ │ └── Behavior
│ │ │ ├── MouseRect
│ │ │ ├── ImageBaseMouseSignBehavior.cs
│ │ │ ├── ImageBaseMouseEnlargeBehavior.cs
│ │ │ └── ImageBaseMouseDrawRectBehaviorBase.cs
│ │ │ ├── ImageBaseMouseDragBehavior.cs
│ │ │ ├── ImageBaseMouseBubbleBehavior.cs
│ │ │ └── ImageBaseMouseWheelBehavior.cs
│ │ ├── HeBianGu.General.ImageCore.nuspec
│ │ ├── HeBianGu.General.ImageCore.csproj
│ │ └── View
│ │ ├── ImageCore.xaml
│ │ └── ImageCore.xaml.cs
├── Application
│ ├── HeBianGu.App.Demo.ImageCore
│ │ ├── App.config
│ │ ├── Properties
│ │ │ ├── Settings.settings
│ │ │ ├── Settings.Designer.cs
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ └── Resources.resx
│ │ ├── App.xaml.cs
│ │ ├── App.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── MainWindow.xaml
│ │ └── HeBianGu.App.Demo.ImageCore.csproj
│ └── HeBianGu.App.Demo.ImagePlayer
│ │ ├── App.config
│ │ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ │ ├── packages.config
│ │ ├── MainWindow.xaml.cs
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainWindow.xaml
│ │ └── HeBianGu.App.Demo.ImagePlayer.csproj
└── UserControl
│ └── HeBianGu.Control.ImagePlayer
│ ├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
│ ├── packages.config
│ ├── Themes
│ ├── Default.xaml
│ └── Generic.xaml
│ ├── HeBianGu.Control.ImagePlayer.csproj
│ └── View
│ ├── ImagePlayer.xaml
│ └── ImagePlayer.xaml.cs
├── Solution
└── hebiangu
│ └── WPF-ImagePlayer.sln
└── .gitignore
/README.md:
--------------------------------------------------------------------------------
1 | # WPF-ImagePlayer
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/nuget-package.bat:
--------------------------------------------------------------------------------
1 | cd %~dp0
2 |
3 | nuget spec -force
4 |
5 | nuget pack -force
6 |
7 | pause
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/nuget-push.bat:
--------------------------------------------------------------------------------
1 | cd %~dp0
2 |
3 | nuget push HeBianGu.General.ImageCore.1.0.0.nupkg oy2kqdkpvlf4elezi2hqhiljdb6ccsneblnafnsduysm7i -Source https://api.nuget.org/v3/index.json
4 |
5 | pause
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace HeBianGu.App.Demo.ImageCore
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Themes/Default.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Mark/LoactionArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace HeBianGu.General.ImageCore
7 | {
8 | public class LoactionArgs : EventArgs
9 | {
10 | public readonly double Left;
11 |
12 | public readonly double Top;
13 |
14 | public LoactionArgs(double left, double top)
15 | {
16 | Left = left;
17 | Top = top;
18 | }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/OperateType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace HeBianGu.General.ImageCore
8 | {
9 | /// 图片操作模式
10 | public enum OperateType
11 | {
12 | /// 默认样式
13 | Default=0,
14 | /// 标记框
15 | Sign,
16 | /// 标记框放大
17 | Enlarge,
18 | /// 气泡放大
19 | Bubble,
20 | /// 气泡放大
21 | None
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace HeBianGu.App.Demo.ImageCore
17 | {
18 | ///
19 | /// MainWindow.xaml 的交互逻辑
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/HeBianGu.General.ImageCore.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $title$
7 | $author$
8 | $author$
9 | http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE
10 | http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE
11 | http://ICON_URL_HERE_OR_DELETE_THIS_LINE
12 | false
13 | $description$
14 | Summary of changes made in this release of the package.
15 | Copyright 2020
16 | Tag1 Tag2
17 |
18 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace HeBianGu.App.Demo.ImagePlayer
18 | {
19 | ///
20 | /// MainWindow.xaml 的交互逻辑
21 | ///
22 | public partial class MainWindow
23 | {
24 | public MainWindow()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Rectangle/RectangleLayer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Ink;
8 | using System.Windows.Media;
9 |
10 | namespace HeBianGu.General.ImageCore
11 | {
12 | ///
13 | ///矩形图集合
14 | ///
15 | public class RectangleLayer : Collection
16 | {
17 | ///
18 | /// 集合图形是否可见
19 | ///
20 | public bool IsVisible
21 | {
22 | set
23 | {
24 | foreach (var item in this)
25 | {
26 | item.Visibility = value?System.Windows.Visibility.Visible:System.Windows.Visibility.Collapsed;
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Behavior/MouseRect/ImageBaseMouseSignBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Input;
9 |
10 | namespace HeBianGu.General.ImageCore
11 | {
12 | /// 但点击当前控件时ListBoxItem项值也选中
13 | public class ImageBaseMouseSignBehavior : ImageBaseMouseDrawRectBehaviorBase
14 | {
15 | public ImageBaseMouseSignBehavior(ImageCore imageBase) : base(imageBase)
16 | {
17 |
18 | }
19 |
20 | protected override void OnOverDrawRect(Rect rect)
21 | {
22 | AssociatedObject.AddShape(rect);
23 | }
24 |
25 | protected override bool IsMatch()
26 | {
27 | return AssociatedObject.OperateType == OperateType.Sign;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.General.ImageCore.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.App.Demo.ImageCore.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.App.Demo.ImagePlayer.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.Control.ImagePlayer.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Rectangle/IRectangleStroke.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 |
5 | namespace HeBianGu.General.ImageCore
6 | {
7 | ///
8 | /// 矩形图形接口
9 | ///
10 | public interface IRectangleStroke
11 | {
12 | ///
13 | /// 清理图形
14 | ///
15 | ///
16 | void Clear(InkCanvas canvas);
17 |
18 | ///
19 | /// 清理图形
20 | ///
21 | ///
22 | void Clear();
23 |
24 | ///
25 | /// 绘制图形
26 | ///
27 | ///
28 | void Draw(InkCanvas canvas);
29 |
30 | ///
31 | /// 图形是否可见
32 | ///
33 | Visibility Visibility { get; set; }
34 |
35 | ///
36 | /// 是否被选中
37 | ///
38 | bool IsSelected { get; }
39 |
40 | ///
41 | /// 设置选中
42 | ///
43 | void SetSelected();
44 |
45 | ///
46 | /// 选中改变事件
47 | ///
48 |
49 | event Action Selected;
50 | }
51 | }
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Behavior/MouseRect/ImageBaseMouseEnlargeBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Input;
9 | using System.Windows.Media;
10 |
11 | namespace HeBianGu.General.ImageCore
12 | {
13 | /// 但点击当前控件时ListBoxItem项值也选中
14 | public class ImageBaseMouseEnlargeBehavior : ImageBaseMouseDrawRectBehaviorBase
15 | {
16 | public ImageBaseMouseEnlargeBehavior(ImageCore imageBase) : base(imageBase)
17 | {
18 |
19 | }
20 | #region - 绘制矩形框和相关操作 -
21 |
22 | void ShowPartWithShape(RectangleShape rectangle)
23 | {
24 | RectangleGeometry rect = new RectangleGeometry(new Rect(0, 0, AssociatedObject._centerCanvas.ActualWidth, AssociatedObject._centerCanvas.ActualHeight));
25 |
26 | // Do:设置覆盖的蒙版
27 | var geo = Geometry.Combine(rect, new RectangleGeometry(rectangle.Rect), GeometryCombineMode.Exclude, null);
28 |
29 | DynamicShape shape = new DynamicShape(rectangle);
30 |
31 | AssociatedObject.ShowShape(rectangle.Rect);
32 |
33 | AssociatedObject._dynamic.Visibility = Visibility.Collapsed;
34 | }
35 |
36 | protected override void OnOverDrawRect(Rect rect)
37 | {
38 | AssociatedObject.ShowShape(rect);
39 | }
40 |
41 | protected override bool IsMatch()
42 | {
43 | return AssociatedObject.OperateType == OperateType.Enlarge;
44 | }
45 |
46 | #endregion
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Themes/Default.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
27 |
28 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | https://mtl.gzhuibei.com/images/img/21547/23.jpg
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("HeBianGu.Control.ImagePlayer")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("HeBianGu.Control.ImagePlayer")]
15 | [assembly: AssemblyCopyright("Copyright © 2020")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("HeBianGu.General.ImageView")]
11 | [assembly: AssemblyDescription("HeBianGu自定义图片查看控件")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("HeBianGu")]
14 | [assembly: AssemblyProduct("HeBianGu.General.ImageView")]
15 | [assembly: AssemblyCopyright("Copyright © 2020 By HeBianGu")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("HeBianGu.App.Demo.ImagePlayer")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("HeBianGu.App.Demo.ImagePlayer")]
15 | [assembly: AssemblyCopyright("Copyright © 2020")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("HeBianGu.App.Demo.ImageCore")]
11 | [assembly: AssemblyDescription("河边骨图片查看控件")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("HeBianGu")]
14 | [assembly: AssemblyProduct("河边骨图片查看控件")]
15 | [assembly: AssemblyCopyright("Copyright © 2020 HeBianGu")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
52 | //通过使用 "*",如下所示:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using HeBianGu.Base.WpfBase;
2 | using HeBianGu.General.WpfControlLib;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Configuration;
6 | using System.Data;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Media;
11 |
12 | namespace HeBianGu.App.Demo.ImagePlayer
13 | {
14 | ///
15 | /// App.xaml 的交互逻辑
16 | ///
17 | public partial class App : ApplicationBase
18 | {
19 | protected override void OnStartup(StartupEventArgs e)
20 | {
21 | MainWindow shellWindow = new MainWindow();
22 |
23 | shellWindow.Show();
24 |
25 | base.OnStartup(e);
26 | }
27 |
28 |
29 | protected override void ConfigureServices(IServiceCollection services)
30 | {
31 | //// Do :注册本地化配置读写服务
32 | //services.AddSingleton();
33 |
34 | //// Do :注册日志服务
35 | //services.AddSingleton();
36 |
37 |
38 | }
39 |
40 | protected override void Configure(IApplicationBuilder app)
41 | {
42 | // Do:设置默认主题
43 | app.UseLocalTheme(l =>
44 | {
45 | l.AccentColor = Color.FromRgb(0x64, 0x76, 0x87);
46 | l.SmallFontSize = 15D;
47 | l.LargeFontSize = 18D;
48 | l.FontSize = FontSize.Small;
49 |
50 | l.ItemHeight = 35;
51 | //l.ItemWidth = 120;
52 | l.ItemCornerRadius = 5;
53 |
54 | l.AnimalSpeed = 5000;
55 |
56 | l.AccentColorSelectType = 0;
57 |
58 | l.IsUseAnimal = true;
59 |
60 | l.ThemeType = ThemeType.Light;
61 |
62 | l.Language = Language.Chinese;
63 | });
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.Control.ImagePlayer.Properties {
12 |
13 |
14 | ///
15 | /// 强类型资源类,用于查找本地化字符串等。
16 | ///
17 | // 此类是由 StronglyTypedResourceBuilder
18 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
19 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
20 | // (以 /str 作为命令选项),或重新生成 VS 项目。
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources {
25 |
26 | private static global::System.Resources.ResourceManager resourceMan;
27 |
28 | private static global::System.Globalization.CultureInfo resourceCulture;
29 |
30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
31 | internal Resources() {
32 | }
33 |
34 | ///
35 | /// 返回此类使用的缓存 ResourceManager 实例。
36 | ///
37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
38 | internal static global::System.Resources.ResourceManager ResourceManager {
39 | get {
40 | if ((resourceMan == null)) {
41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeBianGu.Control.ImagePlayer.Properties.Resources", typeof(Resources).Assembly);
42 | resourceMan = temp;
43 | }
44 | return resourceMan;
45 | }
46 | }
47 |
48 | ///
49 | /// 覆盖当前线程的 CurrentUICulture 属性
50 | /// 使用此强类型的资源类的资源查找。
51 | ///
52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
53 | internal static global::System.Globalization.CultureInfo Culture {
54 | get {
55 | return resourceCulture;
56 | }
57 | set {
58 | resourceCulture = value;
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Mark/IndicatorObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 |
8 | namespace HeBianGu.General.ImageCore
9 | {
10 | internal class IndicatorObject : Canvas
11 | {
12 | private MaskCanvas canvasOwner;
13 |
14 | public IndicatorObject(MaskCanvas canvasOwner)
15 | {
16 | this.canvasOwner = canvasOwner;
17 | }
18 |
19 | static IndicatorObject()
20 | {
21 | var ownerType = typeof(IndicatorObject);
22 |
23 | FocusVisualStyleProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(null));
24 | DefaultStyleKeyProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(ownerType));
25 | MinWidthProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(5.0));
26 | MinHeightProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(5.0));
27 | }
28 |
29 | public void Move(System.Windows.Point offset)
30 | {
31 | var x = Canvas.GetLeft(this) + offset.X;
32 | var y = Canvas.GetTop(this) + offset.Y;
33 |
34 |
35 |
36 | //if (x<0)
37 | //{
38 | // this.Width = Math.Max(this.Width + x,0);
39 | //}
40 |
41 | //if (y < 0)
42 | //{
43 | // this.Height = Math.Max(this.Height + x, 0);
44 | //}
45 |
46 | //x = x < 0 ? 0 : x;
47 | //y = y < 0 ? 0 : y;
48 |
49 | //x = Math.Min(x, this.canvasOwner.Width - this.Width);
50 | //y = Math.Min(y, this.canvasOwner.Height - this.Height);
51 |
52 | Canvas.SetLeft(this, x);
53 | Canvas.SetTop(this, y);
54 |
55 | canvasOwner.UpdateSelectionRegion(new Rect(x, y, Width, Height), true);
56 | }
57 |
58 |
59 | public void MoveCenter(System.Windows.Point offset)
60 | {
61 | var x = offset.X- this.Width / 2;
62 | var y = offset.Y- this.Height / 2;
63 |
64 | Canvas.SetLeft(this, x);
65 | Canvas.SetTop(this, y);
66 |
67 | canvasOwner.UpdateSelectionRegion(new Rect(x, y, Width, Height), true);
68 | }
69 |
70 | public double WidthPercent
71 | {
72 | get
73 | {
74 | return this.Width / this.canvasOwner.Width;
75 | }
76 | }
77 |
78 | public double HeightPercent
79 | {
80 | get
81 | {
82 | return this.Height / this.canvasOwner.Height;
83 | }
84 | }
85 |
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.General.ImageCore.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeBianGu.General.ImageCore.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 重写当前线程的 CurrentUICulture 属性
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.App.Demo.ImageCore.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeBianGu.App.Demo.ImageCore.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace HeBianGu.App.Demo.ImagePlayer.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeBianGu.App.Demo.ImagePlayer.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Solution/hebiangu/WPF-ImagePlayer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29230.47
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 - Application", "1 - Application", "{F0B44989-BF14-41A4-83E8-95BC99504412}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3 - Gereral", "3 - Gereral", "{DB155184-ECA0-4D07-93BF-4AEDD2D90A88}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeBianGu.App.Demo.ImageCore", "..\..\Source\Application\HeBianGu.App.Demo.ImageCore\HeBianGu.App.Demo.ImageCore.csproj", "{43C77071-A939-4C83-BE54-84DD1B7F3002}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeBianGu.General.ImageCore", "..\..\Source\General\HeBianGu.General.ImageCore\HeBianGu.General.ImageCore.csproj", "{135BE864-21A3-4CF4-B784-B950783C4B5C}"
13 | EndProject
14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 - UserControl", "2 - UserControl", "{F6D2CE40-61FE-42CA-834E-0D142963B824}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeBianGu.Control.ImagePlayer", "..\..\Source\UserControl\HeBianGu.Control.ImagePlayer\HeBianGu.Control.ImagePlayer.csproj", "{BFB86748-F913-4D4E-8AAE-8AF884C2FB61}"
17 | EndProject
18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4 - Base", "4 - Base", "{54545F1D-2FC1-46BB-9B4D-1B78A04E5884}"
19 | EndProject
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeBianGu.App.Demo.ImagePlayer", "..\..\Source\Application\HeBianGu.App.Demo.ImagePlayer\HeBianGu.App.Demo.ImagePlayer.csproj", "{D24A714E-F788-421A-AEE9-56EB649243C3}"
21 | EndProject
22 | Global
23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 | Debug|Any CPU = Debug|Any CPU
25 | Release|Any CPU = Release|Any CPU
26 | EndGlobalSection
27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 | {43C77071-A939-4C83-BE54-84DD1B7F3002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {43C77071-A939-4C83-BE54-84DD1B7F3002}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {43C77071-A939-4C83-BE54-84DD1B7F3002}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {43C77071-A939-4C83-BE54-84DD1B7F3002}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {135BE864-21A3-4CF4-B784-B950783C4B5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {135BE864-21A3-4CF4-B784-B950783C4B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {135BE864-21A3-4CF4-B784-B950783C4B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {135BE864-21A3-4CF4-B784-B950783C4B5C}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {BFB86748-F913-4D4E-8AAE-8AF884C2FB61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {BFB86748-F913-4D4E-8AAE-8AF884C2FB61}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {BFB86748-F913-4D4E-8AAE-8AF884C2FB61}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 | {BFB86748-F913-4D4E-8AAE-8AF884C2FB61}.Release|Any CPU.Build.0 = Release|Any CPU
40 | {D24A714E-F788-421A-AEE9-56EB649243C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {D24A714E-F788-421A-AEE9-56EB649243C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {D24A714E-F788-421A-AEE9-56EB649243C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {D24A714E-F788-421A-AEE9-56EB649243C3}.Release|Any CPU.Build.0 = Release|Any CPU
44 | EndGlobalSection
45 | GlobalSection(SolutionProperties) = preSolution
46 | HideSolutionNode = FALSE
47 | EndGlobalSection
48 | GlobalSection(NestedProjects) = preSolution
49 | {43C77071-A939-4C83-BE54-84DD1B7F3002} = {F0B44989-BF14-41A4-83E8-95BC99504412}
50 | {135BE864-21A3-4CF4-B784-B950783C4B5C} = {DB155184-ECA0-4D07-93BF-4AEDD2D90A88}
51 | {BFB86748-F913-4D4E-8AAE-8AF884C2FB61} = {F6D2CE40-61FE-42CA-834E-0D142963B824}
52 | {D24A714E-F788-421A-AEE9-56EB649243C3} = {F0B44989-BF14-41A4-83E8-95BC99504412}
53 | EndGlobalSection
54 | GlobalSection(ExtensibilityGlobals) = postSolution
55 | SolutionGuid = {5EF2E071-0F99-4784-A498-CEC7A6A02A3B}
56 | EndGlobalSection
57 | EndGlobal
58 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Behavior/MouseRect/ImageBaseMouseDrawRectBehaviorBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Input;
9 | using System.Windows.Media;
10 |
11 | namespace HeBianGu.General.ImageCore
12 | {
13 | /// 但点击当前控件时ListBoxItem项值也选中
14 | public abstract class ImageBaseMouseDrawRectBehaviorBase : Behavior
15 | {
16 | public ImageBaseMouseDrawRectBehaviorBase(ImageCore imageBase) : base(imageBase)
17 | {
18 |
19 | }
20 |
21 | protected override void OnAttached()
22 | {
23 | AssociatedObject.Loaded += AssociatedObject_Loaded;
24 | }
25 |
26 | private void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
27 | {
28 | AssociatedObject._centerCanvas.MouseMove += InkCanvas_MouseMove;
29 | AssociatedObject._centerCanvas.MouseDown += InkCanvas_MouseDown;
30 | AssociatedObject._centerCanvas.MouseUp += InkCanvas_MouseUp;
31 | AssociatedObject._centerCanvas.MouseLeave += InkCanvas_MouseLeave;
32 | }
33 |
34 |
35 | protected override void OnDetaching()
36 | {
37 | AssociatedObject._centerCanvas.MouseMove -= InkCanvas_MouseMove;
38 | AssociatedObject._centerCanvas.MouseDown -= InkCanvas_MouseDown;
39 | AssociatedObject._centerCanvas.MouseUp -= InkCanvas_MouseUp;
40 | AssociatedObject._centerCanvas.MouseLeave -= InkCanvas_MouseLeave;
41 |
42 | AssociatedObject.Loaded -= AssociatedObject_Loaded;
43 | }
44 |
45 | #region - 绘制矩形框和相关操作 -
46 |
47 | System.Windows.Point start;
48 | private void InkCanvas_MouseDown(object sender, MouseButtonEventArgs e)
49 | {
50 | if (!this.IsMatch()) return;
51 |
52 | AssociatedObject._dynamic.BegionMatch(true);
53 |
54 | start = e.GetPosition(sender as InkCanvas);
55 | }
56 | private void InkCanvas_MouseMove(object sender, MouseEventArgs e)
57 | {
58 | if (!this.IsMatch()) return;
59 |
60 | if (e.LeftButton != MouseButtonState.Pressed) return;
61 |
62 | if (this.start.X <= 0) return;
63 |
64 | Point end = e.GetPosition(AssociatedObject._centerCanvas);
65 |
66 | //this._isMatch = Math.Abs(start.X - end.X) > 50 && Math.Abs(start.Y - end.Y) > 50;
67 |
68 | AssociatedObject._dynamic.Visibility = Visibility.Visible;
69 |
70 | AssociatedObject._dynamic.Refresh(start, end);
71 |
72 | }
73 | private void InkCanvas_MouseUp(object sender, MouseButtonEventArgs e)
74 | {
75 | if (!this.IsMatch()) return;
76 |
77 | // Do:检查选择区域是否可用
78 | if (!AssociatedObject._dynamic.IsMatch())
79 | {
80 | AssociatedObject._dynamic.Visibility = Visibility.Collapsed;
81 | return;
82 | };
83 |
84 | if (this.start.X <= 0) return;
85 |
86 | this.OnOverDrawRect(AssociatedObject._dynamic.Rect);
87 |
88 | AssociatedObject._dynamic.Visibility = Visibility.Collapsed;
89 |
90 | //// Message:设置只允许放大一次
91 | //this.SetMarkType(MarkType.None);
92 |
93 | // Do:将数据初始化
94 | start = new System.Windows.Point(-1, -1);
95 |
96 |
97 | }
98 | private void InkCanvas_MouseLeave(object sender, MouseEventArgs e)
99 | {
100 | if (this.start.X <= 0) return;
101 |
102 | if (e.LeftButton == MouseButtonState.Released) return;
103 |
104 | InkCanvas_MouseUp(sender, null);
105 | }
106 |
107 | #endregion
108 |
109 | protected abstract void OnOverDrawRect(Rect rect);
110 |
111 | protected abstract bool IsMatch();
112 |
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/HeBianGu.App.Demo.ImageCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {43C77071-A939-4C83-BE54-84DD1B7F3002}
8 | WinExe
9 | HeBianGu.App.Demo.ImageCore
10 | HeBianGu.App.Demo.ImageCore
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 4.0
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | MSBuild:Compile
55 | Designer
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | App.xaml
63 | Code
64 |
65 |
66 | MainWindow.xaml
67 | Code
68 |
69 |
70 |
71 |
72 | Code
73 |
74 |
75 | True
76 | True
77 | Resources.resx
78 |
79 |
80 | True
81 | Settings.settings
82 | True
83 |
84 |
85 | ResXFileCodeGenerator
86 | Resources.Designer.cs
87 |
88 |
89 | SettingsSingleFileGenerator
90 | Settings.Designer.cs
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | {135be864-21a3-4cf4-b784-b950783c4b5c}
99 | HeBianGu.General.ImageCore
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Behavior/ImageBaseMouseDragBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Input;
8 |
9 | namespace HeBianGu.General.ImageCore
10 | {
11 | /// 但点击当前控件时ListBoxItem项值也选中
12 | public class ImageBaseMouseDragBehavior : Behavior
13 | {
14 | public ImageBaseMouseDragBehavior(ImageCore imageBase) : base(imageBase)
15 | {
16 |
17 | }
18 | protected override void OnAttached()
19 | {
20 | AssociatedObject.Loaded += AssociatedObject_Loaded;
21 | }
22 |
23 | private void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
24 | {
25 | AssociatedObject.grid_Mouse_drag.PreviewMouseDown += control_MouseDown;
26 | AssociatedObject.grid_Mouse_drag.PreviewMouseUp += control_MouseUp;
27 | AssociatedObject.grid_Mouse_drag.PreviewMouseMove += control_MouseMove;
28 | }
29 |
30 | protected override void OnDetaching()
31 | {
32 | AssociatedObject.grid_Mouse_drag.PreviewMouseDown -= control_MouseDown;
33 | AssociatedObject.grid_Mouse_drag.PreviewMouseUp -= control_MouseUp;
34 | AssociatedObject.grid_Mouse_drag.PreviewMouseMove -= control_MouseMove;
35 |
36 | AssociatedObject.Loaded -= AssociatedObject_Loaded;
37 | }
38 |
39 | #region - 鸟撖图操作 -
40 |
41 | bool mouseDown;
42 |
43 | Point mouseXY;
44 |
45 | void control_MouseMove(object sender, MouseEventArgs e)
46 | {
47 | if ((AssociatedObject.OperateType != OperateType.Default) && e.MiddleButton == MouseButtonState.Released)
48 | {
49 | return;
50 | }
51 |
52 | if (AssociatedObject.imgWidth == 0 || AssociatedObject.imgHeight == 0)
53 | return;
54 |
55 | var img = sender as UIElement;
56 | if (img == null)
57 | {
58 | return;
59 | }
60 | if (mouseDown)
61 | {
62 | Domousemove(img, e);
63 | }
64 | }
65 |
66 | private void Domousemove(UIElement img, MouseEventArgs e)
67 | {
68 | if ((AssociatedObject.OperateType != OperateType.Default) && e.MiddleButton == MouseButtonState.Released)
69 | {
70 | return;
71 | }
72 |
73 | var position = e.GetPosition(img);
74 | double X = mouseXY.X - position.X;
75 | double Y = mouseXY.Y - position.Y;
76 | mouseXY = position;
77 | if (X != 0)
78 | AssociatedObject._svDefault.ScrollToHorizontalOffset(AssociatedObject._svDefault.HorizontalOffset + X);
79 | if (Y != 0)
80 | AssociatedObject._svDefault.ScrollToVerticalOffset(AssociatedObject._svDefault.VerticalOffset + Y);
81 |
82 | AssociatedObject.GetOffSetRate();
83 | }
84 |
85 | void control_MouseUp(object sender, MouseButtonEventArgs e)
86 | {
87 | if ((AssociatedObject.OperateType != OperateType.Default && e.ChangedButton != MouseButton.Middle))
88 | {
89 | return;
90 | }
91 |
92 | var img = sender as UIElement;
93 |
94 |
95 | if (img == null)
96 | {
97 | return;
98 | }
99 | img.ReleaseMouseCapture();
100 |
101 | mouseDown = false;
102 |
103 |
104 | //this.RefreshCursor();
105 | }
106 |
107 | void control_MouseDown(object sender, MouseButtonEventArgs e)
108 | {
109 | if ((AssociatedObject.OperateType != OperateType.Default && e.ChangedButton != MouseButton.Middle))
110 | {
111 | return;
112 | }
113 |
114 | AssociatedObject.Cursor = Cursors.Hand;
115 |
116 | //if (e.ChangedButton == MouseButton.Middle)
117 | //{
118 | // AssociatedObject.Cursor = Cursors.Hand;
119 | //}
120 | //else
121 | //{
122 | // if ((AssociatedObject.OperateType != OperateType.Default)) return;
123 | //}
124 |
125 | var img = sender as UIElement;
126 |
127 | if (img == null)
128 | {
129 | return;
130 | }
131 |
132 | img.CaptureMouse();
133 |
134 | mouseDown = true;
135 |
136 | mouseXY = e.GetPosition(img);
137 |
138 | }
139 |
140 | #endregion
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Behavior/ImageBaseMouseBubbleBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Input;
9 |
10 | namespace HeBianGu.General.ImageCore
11 | {
12 | /// 但点击当前控件时ListBoxItem项值也选中
13 | public class ImageBaseMouseBubbleBehavior : Behavior
14 | {
15 | public ImageBaseMouseBubbleBehavior(ImageCore imageBase):base(imageBase)
16 | {
17 |
18 | }
19 |
20 | protected override void OnAttached()
21 | {
22 | AssociatedObject._centerCanvas.MouseMove += InkCanvas_MouseMove;
23 | AssociatedObject._centerCanvas.MouseEnter += _centerCanvas_MouseEnter;
24 | AssociatedObject._centerCanvas.MouseLeave += _centerCanvas_MouseLeave;
25 | }
26 |
27 | protected override void OnDetaching()
28 | {
29 | AssociatedObject._centerCanvas.MouseMove -= InkCanvas_MouseMove;
30 | AssociatedObject._centerCanvas.MouseEnter -= _centerCanvas_MouseEnter;
31 | AssociatedObject._centerCanvas.MouseLeave -= _centerCanvas_MouseLeave;
32 | }
33 |
34 | #region - 放大镜效果 -
35 |
36 |
37 | private void InkCanvas_MouseMove(object sender, MouseEventArgs e)
38 | {
39 | if (AssociatedObject.OperateType != OperateType.Bubble) return;
40 |
41 | FrameworkElement element = sender as FrameworkElement;
42 |
43 | // 计算鼠标在X轴的移动距离
44 | double deltaV = e.GetPosition(element).Y;
45 | //计算鼠标在Y轴的移动距离
46 | double deltaH = e.GetPosition(element).X;
47 |
48 | double newTop = deltaV - AssociatedObject.MoveRect.ActualHeight / 2 <= 0 ? 0 : deltaV - AssociatedObject.MoveRect.ActualHeight / 2;
49 | double newLeft = deltaH - AssociatedObject.MoveRect.ActualWidth / 2 <= 0 ? 0 : deltaH - AssociatedObject.MoveRect.ActualWidth / 2;
50 |
51 | newTop = deltaV + AssociatedObject.MoveRect.ActualHeight / 2 > AssociatedObject._centerCanvas.ActualHeight ? AssociatedObject._centerCanvas.ActualHeight - AssociatedObject.MoveRect.ActualHeight : newTop;
52 | newLeft = deltaH + AssociatedObject.MoveRect.ActualWidth / 2 > AssociatedObject._centerCanvas.ActualWidth ? AssociatedObject._centerCanvas.ActualWidth - AssociatedObject.MoveRect.ActualWidth : newLeft;
53 |
54 | AssociatedObject.MoveRect.SetValue(InkCanvas.TopProperty, newTop);
55 | AssociatedObject.MoveRect.SetValue(InkCanvas.LeftProperty, newLeft);
56 |
57 | AdjustBigImage();
58 |
59 | var position2 = Mouse.GetPosition(AssociatedObject.grid_all);
60 |
61 | AssociatedObject.popup.Margin = new Thickness(position2.X - AssociatedObject.popup.Width / 2, position2.Y - AssociatedObject.popup.Height / 2, 0, 0);
62 |
63 | //if (this.start.X <= 0 || this.start.Y <= 0) { return; }
64 |
65 | return;
66 |
67 | }
68 |
69 |
70 | private void _centerCanvas_MouseLeave(object sender, MouseEventArgs e)
71 | {
72 | if (AssociatedObject.OperateType != OperateType.Bubble) return;
73 |
74 | AssociatedObject.popup.Visibility = Visibility.Collapsed;
75 | }
76 |
77 | private void _centerCanvas_MouseEnter(object sender, MouseEventArgs e)
78 | {
79 | if (AssociatedObject.OperateType != OperateType.Bubble) return;
80 | AssociatedObject.popup.Visibility = Visibility.Visible;
81 | }
82 | ///
83 | /// 调整右侧大图的位置
84 | ///
85 | void AdjustBigImage()
86 | {
87 | //获取右侧大图框与透明矩形框的尺寸比率
88 | double n = AssociatedObject.BigBox.Width / AssociatedObject.MoveRect.Width;
89 |
90 | //获取半透明矩形框在左侧小图中的位置
91 | double left = (double)AssociatedObject.MoveRect.GetValue(InkCanvas.LeftProperty);
92 | double top = (double)AssociatedObject.MoveRect.GetValue(InkCanvas.TopProperty);
93 |
94 | //计算和设置原图在右侧大图框中的Canvas.Left 和 Canvas.Top
95 | double newLeft = -left * n;
96 | double newTop = -top * n;
97 | AssociatedObject.bigImg.SetValue(Canvas.LeftProperty, newLeft);
98 | AssociatedObject.bigImg.SetValue(Canvas.TopProperty, newTop);
99 | }
100 |
101 | #endregion
102 | }
103 |
104 |
105 | public abstract class Behavior: IBehavior
106 | {
107 | public T AssociatedObject { get; set; }
108 |
109 | public Behavior(T t)
110 | {
111 | AssociatedObject = t;
112 | }
113 |
114 | protected abstract void OnAttached();
115 |
116 | protected abstract void OnDetaching();
117 |
118 | public void RegisterBehavior()
119 | {
120 | this.OnAttached();
121 | }
122 | }
123 |
124 | public interface IBehavior
125 | {
126 | void RegisterBehavior();
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/HeBianGu.Control.ImagePlayer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BFB86748-F913-4D4E-8AAE-8AF884C2FB61}
8 | library
9 | HeBianGu.Control.ImagePlayer
10 | HeBianGu.Control.ImagePlayer
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\..\..\Solution\hebiangu\packages\HeBianGu.Base.WpfBase.2.1.4\lib\net45\HeBianGu.Base.WpfBase.dll
37 |
38 |
39 | ..\..\..\Solution\hebiangu\packages\HeBianGu.General.WpfControlLib.2.1.4\lib\net45\HeBianGu.General.WpfControlLib.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 4.0
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | MSBuild:Compile
60 | Designer
61 |
62 |
63 | MSBuild:Compile
64 | Designer
65 |
66 |
67 | ImagePlayer.xaml
68 |
69 |
70 | MSBuild:Compile
71 | Designer
72 |
73 |
74 |
75 |
76 | Code
77 |
78 |
79 | True
80 | True
81 | Resources.resx
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 | ResXFileCodeGenerator
90 | Resources.Designer.cs
91 |
92 |
93 |
94 | SettingsSingleFileGenerator
95 | Settings.Designer.cs
96 |
97 |
98 |
99 |
100 | {135be864-21a3-4cf4-b784-b950783c4b5c}
101 | HeBianGu.General.ImageCore
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/HeBianGu.General.ImageCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {135BE864-21A3-4CF4-B784-B950783C4B5C}
8 | library
9 | HeBianGu.General.ImageCore
10 | HeBianGu.General.ImageCore
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 4.0
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | MSBuild:Compile
54 | Designer
55 |
56 |
57 | MSBuild:Compile
58 | Designer
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 |
66 |
67 | Code
68 |
69 |
70 | True
71 | True
72 | Resources.resx
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | ImageCore.xaml
94 |
95 |
96 | ResXFileCodeGenerator
97 | Resources.Designer.cs
98 |
99 |
100 | SettingsSingleFileGenerator
101 | Settings.Designer.cs
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 | https://mtl.gzhuibei.com/images/img/21547/1.jpg
19 | https://mtl.gzhuibei.com/images/img/21547/2.jpg
20 | https://mtl.gzhuibei.com/images/img/21547/3.jpg
21 | https://mtl.gzhuibei.com/images/img/21547/4.jpg
22 | https://mtl.gzhuibei.com/images/img/21547/5.jpg
23 | https://mtl.gzhuibei.com/images/img/21547/6.jpg
24 | https://mtl.gzhuibei.com/images/img/21547/7.jpg
25 | https://mtl.gzhuibei.com/images/img/21547/8.jpg
26 | https://mtl.gzhuibei.com/images/img/21547/9.jpg
27 | https://mtl.gzhuibei.com/images/img/21547/10.jpg
28 | https://mtl.gzhuibei.com/images/img/21547/11.jpg
29 | https://mtl.gzhuibei.com/images/img/21547/12.jpg
30 | https://mtl.gzhuibei.com/images/img/21547/13.jpg
31 | https://mtl.gzhuibei.com/images/img/21547/14.jpg
32 | https://mtl.gzhuibei.com/images/img/21547/15.jpg
33 | https://mtl.gzhuibei.com/images/img/21547/16.jpg
34 | https://mtl.gzhuibei.com/images/img/21547/17.jpg
35 | https://mtl.gzhuibei.com/images/img/21547/18.jpg
36 | https://mtl.gzhuibei.com/images/img/21547/19.jpg
37 | https://mtl.gzhuibei.com/images/img/21547/20.jpg
38 | https://mtl.gzhuibei.com/images/img/21547/21.jpg
39 | https://mtl.gzhuibei.com/images/img/21547/22.jpg
40 | https://mtl.gzhuibei.com/images/img/21547/23.jpg
41 | https://mtl.gzhuibei.com/images/img/21547/24.jpg
42 | https://mtl.gzhuibei.com/images/img/21547/25.jpg
43 | https://mtl.gzhuibei.com/images/img/21547/26.jpg
44 | https://mtl.gzhuibei.com/images/img/21547/27.jpg
45 | https://mtl.gzhuibei.com/images/img/21547/28.jpg
46 | https://mtl.gzhuibei.com/images/img/21547/29.jpg
47 | https://mtl.gzhuibei.com/images/img/21547/30.jpg
48 | https://mtl.gzhuibei.com/images/img/21547/31.jpg
49 | https://mtl.gzhuibei.com/images/img/21547/32.jpg
50 | https://mtl.gzhuibei.com/images/img/21547/33.jpg
51 | https://mtl.gzhuibei.com/images/img/21547/34.jpg
52 | https://mtl.gzhuibei.com/images/img/21547/35.jpg
53 | https://mtl.gzhuibei.com/images/img/21547/36.jpg
54 | https://mtl.gzhuibei.com/images/img/21547/37.jpg
55 | https://mtl.gzhuibei.com/images/img/21547/38.jpg
56 | https://mtl.gzhuibei.com/images/img/21547/39.jpg
57 | https://mtl.gzhuibei.com/images/img/21547/40.jpg
58 | https://mtl.gzhuibei.com/images/img/21547/41.jpg
59 | https://mtl.gzhuibei.com/images/img/21547/42.jpg
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/HeBianGu.App.Demo.ImagePlayer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D24A714E-F788-421A-AEE9-56EB649243C3}
8 | WinExe
9 | HeBianGu.App.Demo.ImagePlayer
10 | HeBianGu.App.Demo.ImagePlayer
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\..\..\Solution\hebiangu\packages\HeBianGu.Base.WpfBase.2.1.4\lib\net45\HeBianGu.Base.WpfBase.dll
39 |
40 |
41 | ..\..\..\Solution\hebiangu\packages\HeBianGu.General.WpfControlLib.2.1.4\lib\net45\HeBianGu.General.WpfControlLib.dll
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 4.0
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 | MSBuild:Compile
66 | Designer
67 |
68 |
69 | App.xaml
70 | Code
71 |
72 |
73 | MainWindow.xaml
74 | Code
75 |
76 |
77 |
78 |
79 | Code
80 |
81 |
82 | True
83 | True
84 | Resources.resx
85 |
86 |
87 | True
88 | Settings.settings
89 | True
90 |
91 |
92 | ResXFileCodeGenerator
93 | Resources.Designer.cs
94 |
95 |
96 |
97 | SettingsSingleFileGenerator
98 | Settings.Designer.cs
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | {135be864-21a3-4cf4-b784-b950783c4b5c}
107 | HeBianGu.General.ImageCore
108 |
109 |
110 | {bfb86748-f913-4d4e-8aae-8af884c2fb61}
111 | HeBianGu.Control.ImagePlayer
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImageCore/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Source/Application/HeBianGu.App.Demo.ImagePlayer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | *.i.cs
73 | *.g.cs
74 | *.cache
75 | *.txt
76 | *.g.resources
77 | *.exe
78 |
79 | # Chutzpah Test files
80 | _Chutzpah*
81 |
82 | # Visual C++ cache files
83 | ipch/
84 | *.aps
85 | *.ncb
86 | *.opendb
87 | *.opensdf
88 | *.sdf
89 | *.cachefile
90 |
91 | # Visual Studio profiler
92 | *.psess
93 | *.vsp
94 | *.vspx
95 | *.sap
96 |
97 | # TFS 2012 Local Workspace
98 | $tf/
99 |
100 | # Guidance Automation Toolkit
101 | *.gpState
102 |
103 | # ReSharper is a .NET coding add-in
104 | _ReSharper*/
105 | *.[Rr]e[Ss]harper
106 | *.DotSettings.user
107 |
108 | # JustCode is a .NET coding add-in
109 | .JustCode
110 |
111 | # TeamCity is a build add-in
112 | _TeamCity*
113 |
114 | # DotCover is a Code Coverage Tool
115 | *.dotCover
116 |
117 | # NCrunch
118 | _NCrunch_*
119 | .*crunch*.local.xml
120 | nCrunchTemp_*
121 |
122 | # MightyMoose
123 | *.mm.*
124 | AutoTest.Net/
125 |
126 | # Web workbench (sass)
127 | .sass-cache/
128 |
129 | # Installshield output folder
130 | [Ee]xpress/
131 |
132 | # DocProject is a documentation generator add-in
133 | DocProject/buildhelp/
134 | DocProject/Help/*.HxT
135 | DocProject/Help/*.HxC
136 | DocProject/Help/*.hhc
137 | DocProject/Help/*.hhk
138 | DocProject/Help/*.hhp
139 | DocProject/Help/Html2
140 | DocProject/Help/html
141 |
142 | # Click-Once directory
143 | publish/
144 |
145 | # Publish Web Output
146 | *.[Pp]ublish.xml
147 | *.azurePubxml
148 | # TODO: Comment the next line if you want to checkin your web deploy settings
149 | # but database connection strings (with potential passwords) will be unencrypted
150 | *.pubxml
151 | *.publishproj
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/View/ImagePlayer.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/Provider/Behavior/ImageBaseMouseWheelBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Input;
10 |
11 | namespace HeBianGu.General.ImageCore
12 | {
13 | /// 但点击当前控件时ListBoxItem项值也选中
14 | public class ImageBaseMouseWheelBehavior : Behavior
15 | {
16 | public ImageBaseMouseWheelBehavior(ImageCore imageBase) : base(imageBase)
17 | {
18 |
19 | }
20 | protected override void OnAttached()
21 | {
22 | AssociatedObject.Loaded += AssociatedObject_Loaded;
23 | }
24 |
25 | private void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
26 | {
27 | ////gridMouse.MouseWheel += svImg_MouseWheel;
28 |
29 | AssociatedObject._svDefault.ScrollChanged += svImg_ScrollChanged;
30 |
31 | AssociatedObject.rootGrid.MouseWheel += svImg_MouseWheel;
32 |
33 | AssociatedObject.mask.LoationChanged += Mask_LoationChanged;
34 | }
35 |
36 | protected override void OnDetaching()
37 | {
38 |
39 | AssociatedObject._svDefault.ScrollChanged -= svImg_ScrollChanged;
40 |
41 | AssociatedObject.rootGrid.MouseWheel -= svImg_MouseWheel;
42 |
43 | AssociatedObject.mask.LoationChanged -= Mask_LoationChanged;
44 |
45 |
46 | AssociatedObject.Loaded -= AssociatedObject_Loaded;
47 | }
48 |
49 | private void Mask_LoationChanged(object sender, LoactionArgs e)
50 | {
51 | if (AssociatedObject.OperateType == OperateType.Bubble) return;
52 |
53 | var result = GetScrollWidthAndHeight();
54 |
55 | double xleft = (AssociatedObject.rootGrid.ActualWidth - AssociatedObject.vb.ActualWidth) / 2;
56 | double ytop = (AssociatedObject.rootGrid.ActualHeight - AssociatedObject.vb.ActualHeight) / 2;
57 |
58 | AssociatedObject._svDefault.ScrollToHorizontalOffset(e.Left * AssociatedObject._svDefault.ExtentWidth * result.Item1 + xleft);
59 | AssociatedObject._svDefault.ScrollToVerticalOffset(e.Top * AssociatedObject._svDefault.ExtentHeight * result.Item2 + ytop);
60 | }
61 |
62 |
63 | /// 滚动条放大缩小和新方法
64 | void svImg_MouseWheel(object sender, MouseWheelEventArgs e)
65 | {
66 | if (AssociatedObject.OperateType == OperateType.Bubble) return;
67 |
68 | if (AssociatedObject.imgWidth == 0 || AssociatedObject.imgHeight == 0) return;
69 |
70 | // Do:找出ViewBox的左边距和上边距
71 | double x_viewbox_margrn = (AssociatedObject.rootGrid.ActualWidth - AssociatedObject.vb.ActualWidth) / 2;
72 | double y_viewbox_margrn = (AssociatedObject.rootGrid.ActualHeight - AssociatedObject.vb.ActualHeight) / 2;
73 |
74 | // Do:计算边距百分比
75 | double x_viewbox_margrn_percent = x_viewbox_margrn / AssociatedObject.rootGrid.ActualWidth;
76 | double y_viewbox_margrn_percent = y_viewbox_margrn / AssociatedObject.rootGrid.ActualHeight;
77 |
78 | // Do:获取鼠标在绘图区域Canvas的位置的百分比
79 | var position_canvas = e.GetPosition(AssociatedObject._centerCanvas);
80 |
81 | double x_position_canvas_percent = position_canvas.X / AssociatedObject._centerCanvas.ActualWidth;
82 | double y_position_canvas_percent = position_canvas.Y / AssociatedObject._centerCanvas.ActualHeight;
83 |
84 | // Do:获取鼠标站显示窗口GridMouse中的位置
85 | var position_gridMouse = e.GetPosition(AssociatedObject.grid_Mouse_drag);
86 |
87 | // Message:设置图片的缩放
88 | this.ChangeScale(e.Delta > 0 ? AssociatedObject.WheelScale : -AssociatedObject.WheelScale);
89 |
90 | // Message:根据百分比计算放大后滚轮滚动的位置
91 | double xvalue = x_viewbox_margrn_percent * AssociatedObject.rootGrid.ActualWidth + x_position_canvas_percent * AssociatedObject.vb.ActualWidth - position_gridMouse.X;
92 | double yvalue = y_viewbox_margrn_percent * AssociatedObject.rootGrid.ActualHeight + y_position_canvas_percent * AssociatedObject.vb.ActualHeight - position_gridMouse.Y;
93 |
94 | AssociatedObject._svDefault.ScrollToHorizontalOffset(xvalue);
95 | AssociatedObject._svDefault.ScrollToVerticalOffset(yvalue);
96 | }
97 |
98 |
99 | int thumbWidth;
100 | int thumbHeight;
101 |
102 | void svImg_ScrollChanged(object sender, ScrollChangedEventArgs e)
103 | {
104 | if (AssociatedObject.OperateType == OperateType.Bubble) return;
105 |
106 | if (AssociatedObject.imgWidth == 0 || AssociatedObject.imgHeight == 0)
107 | return;
108 |
109 | thumbWidth = (int)AssociatedObject.controlmask.ActualWidth;
110 | thumbHeight = (int)AssociatedObject.controlmask.ActualHeight;
111 |
112 | double xleft = (AssociatedObject.rootGrid.ActualWidth - AssociatedObject.vb.ActualWidth) / 2;
113 | double ytop = (AssociatedObject.rootGrid.ActualHeight - AssociatedObject.vb.ActualHeight) / 2;
114 |
115 |
116 | var result = this.GetScrollWidthAndHeight();
117 |
118 | double scroll_width = AssociatedObject._svDefault.ViewportWidth + AssociatedObject._svDefault.ScrollableWidth;
119 |
120 | double timeH = AssociatedObject._svDefault.ViewportHeight / (AssociatedObject._svDefault.ViewportHeight + AssociatedObject._svDefault.ScrollableHeight);
121 | double timeW = AssociatedObject._svDefault.ViewportWidth / (scroll_width - 2 * xleft);
122 |
123 | double w = thumbWidth * timeW;
124 | double h = thumbHeight * timeH;
125 |
126 | double offsetx = 0;
127 | double offsety = 0;
128 |
129 | if (AssociatedObject._svDefault.ScrollableWidth == 0)
130 | {
131 | offsetx = 0;
132 | }
133 | else
134 | {
135 | offsetx = (w - thumbWidth) / AssociatedObject._svDefault.ScrollableWidth * (AssociatedObject._svDefault.HorizontalOffset);
136 | }
137 |
138 | offsetx = -(AssociatedObject._svDefault.HorizontalOffset - xleft) / (scroll_width - xleft * 2) * thumbWidth;
139 |
140 | if (AssociatedObject._svDefault.ScrollableHeight == 0)
141 | {
142 | offsety = 0;
143 | }
144 | else
145 | {
146 | offsety = (h - thumbHeight) / AssociatedObject._svDefault.ScrollableHeight * AssociatedObject._svDefault.VerticalOffset;
147 | }
148 |
149 | Rect rect = new Rect(-offsetx, -offsety, w, h);
150 |
151 | AssociatedObject.mask.UpdateSelectionRegion(rect);
152 | }
153 |
154 |
155 | Tuple GetScrollWidthAndHeight()
156 | {
157 | double xleft = 1 - (AssociatedObject.rootGrid.ActualWidth - AssociatedObject.vb.ActualWidth) / AssociatedObject.rootGrid.ActualWidth;
158 | double ytop = 1 - (AssociatedObject.rootGrid.ActualHeight - AssociatedObject.vb.ActualHeight) / AssociatedObject.rootGrid.ActualHeight;
159 |
160 | return Tuple.Create(xleft, ytop);
161 | }
162 |
163 | double matchscale;
164 |
165 | bool ChangeScale(double value)
166 | {
167 | matchscale = AssociatedObject.GetFullScale();
168 |
169 | AssociatedObject.Scale = AssociatedObject.Scale + value;
170 |
171 | //SetbtnActualsizeEnable();
172 |
173 | Debug.WriteLine(AssociatedObject.Scale);
174 | Debug.WriteLine(matchscale);
175 |
176 | //btnNarrow.IsEnabled = Scale > matchscale;
177 |
178 | //btnEnlarge.IsEnabled = Scale < MaxScale;
179 |
180 | AssociatedObject.IsMaxScaled = !(AssociatedObject.Scale < AssociatedObject.MaxScale);
181 |
182 | AssociatedObject.IsMinScaled = !(AssociatedObject.Scale > matchscale);
183 |
184 | //this.txtZoom.Text = ((int)(Scale * 100)).ToString() + "%";
185 |
186 | AssociatedObject.OnNoticeMessaged(((int)(AssociatedObject.Scale * 100)).ToString() + "%");
187 |
188 | //if (sb_Tip != null)
189 | // sb_Tip.Begin();
190 |
191 | if (AssociatedObject.Scale < matchscale)
192 | {
193 | AssociatedObject.Scale = matchscale;
194 |
195 | AssociatedObject.OnNoticeMessaged("已最小");
196 |
197 | AssociatedObject._svDefault.IsEnabled = false;
198 | }
199 |
200 | if (AssociatedObject.Scale > AssociatedObject.MaxScale)
201 | {
202 | AssociatedObject.Scale = AssociatedObject.MaxScale;
203 |
204 | AssociatedObject._svDefault.IsEnabled = false;
205 |
206 | AssociatedObject.OnNoticeMessaged("已最大");
207 | }
208 | AssociatedObject._svDefault.IsEnabled = true;
209 |
210 | AssociatedObject.RefreshImageByScale();
211 |
212 | return true;
213 | }
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/Source/General/HeBianGu.General.ImageCore/View/ImageCore.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/Source/UserControl/HeBianGu.Control.ImagePlayer/View/ImagePlayer.xaml.cs:
--------------------------------------------------------------------------------
1 | using HeBianGu.General.ImageCore;
2 | using System;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Collections.Specialized;
7 | using System.ComponentModel;
8 | using System.Diagnostics;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using System.Windows;
13 | using System.Windows.Controls;
14 | using System.Windows.Data;
15 | using System.Windows.Documents;
16 | using System.Windows.Input;
17 | using System.Windows.Media;
18 | using System.Windows.Media.Imaging;
19 | using System.Windows.Navigation;
20 | using System.Windows.Shapes;
21 | using System.Windows.Threading;
22 |
23 | namespace HeBianGu.Control.ImagePlayer
24 | {
25 | [TemplatePart(Name = "PART_IMAGECORE", Type = typeof(ImageCore))]
26 | public partial class ImagePlayer : ContentControl
27 | {
28 | static ImagePlayer()
29 | {
30 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ImagePlayer), new FrameworkPropertyMetadata(typeof(ImagePlayer)));
31 | }
32 |
33 | public static RoutedUICommand PreviousCommand = new RoutedUICommand();
34 | public static RoutedUICommand NextCommand = new RoutedUICommand();
35 |
36 | ImageCore _core = null;
37 |
38 | public ImagePlayer()
39 | {
40 | {
41 | // Do :上一张
42 | CommandBinding command = new CommandBinding(ImagePlayer.PreviousCommand, (l, k) =>
43 | {
44 | string commond = k.Parameter?.ToString();
45 |
46 |
47 | if (this.Current.Previous != null)
48 | {
49 | this.Current = this.Current.Previous;
50 |
51 | this.Index = this.Index - 1;
52 | }
53 | else
54 | {
55 | this.Current = this._cache.Last;
56 |
57 | this.Index = this._cache.Count;
58 |
59 | this.OnCoreMessaged("已是最后一项,自动跳转至第一项");
60 |
61 | }
62 | }, (l, k) => { k.CanExecute = this.Current != null; });
63 |
64 | this.CommandBindings.Add(command);
65 | }
66 | {
67 | // Do :下一张
68 | CommandBinding command = new CommandBinding(ImagePlayer.NextCommand, (l, k) =>
69 | {
70 | string commond = k.Parameter?.ToString();
71 |
72 | if (this.Current.Next != null)
73 | {
74 | this.Current = this.Current.Next;
75 |
76 | this.Index = this.Index + 1;
77 | }
78 | else
79 | {
80 |
81 | this.Current = this._cache.First;
82 | this.Index = 1;
83 | this.OnCoreMessaged("已是最后一项,自动跳转至第一项");
84 | }
85 | }, (l, k) => { k.CanExecute = this.Current != null; });
86 |
87 | this.CommandBindings.Add(command);
88 | }
89 | }
90 |
91 | #region - 初始化 -
92 |
93 | public override void OnApplyTemplate()
94 | {
95 | base.OnApplyTemplate();
96 |
97 | _core = Template.FindName("PART_IMAGECORE", this) as ImageCore;
98 |
99 | if (_core != null)
100 | {
101 | this._core.NoticeMessaged += (l, k) =>
102 | {
103 | this.OnCoreMessaged(this._core.Message);
104 | };
105 | }
106 |
107 | // Do :防止模板未加载,先触发Current依赖属性改变
108 | _core.Loaded +=(l, k) =>
109 | {
110 | if (this.Current == null || this.Current.Value == null) return;
111 |
112 | _core.ImageSource= this.ConvertToImageSource.Invoke(this.Current.Value);
113 | };
114 |
115 | }
116 |
117 | #endregion
118 |
119 |
120 | public Func