├── .gitattributes ├── .gitignore ├── README.md ├── Solution └── hebiangu │ └── WPF-ImagePlayer.sln └── Source ├── Application ├── HeBianGu.App.Demo.ImageCore │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── HeBianGu.App.Demo.ImageCore.csproj │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ └── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings └── HeBianGu.App.Demo.ImagePlayer │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── HeBianGu.App.Demo.ImagePlayer.csproj │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ └── packages.config ├── General └── HeBianGu.General.ImageCore │ ├── HeBianGu.General.ImageCore.csproj │ ├── HeBianGu.General.ImageCore.nuspec │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Provider │ ├── Behavior │ │ ├── ImageBaseMouseBubbleBehavior.cs │ │ ├── ImageBaseMouseDragBehavior.cs │ │ ├── ImageBaseMouseWheelBehavior.cs │ │ └── MouseRect │ │ │ ├── ImageBaseMouseDrawRectBehaviorBase.cs │ │ │ ├── ImageBaseMouseEnlargeBehavior.cs │ │ │ └── ImageBaseMouseSignBehavior.cs │ ├── Mark │ │ ├── IndicatorObject.cs │ │ ├── LoactionArgs.cs │ │ └── MaskCanvas.cs │ ├── OperateType.cs │ └── Rectangle │ │ ├── IRectangleStroke.cs │ │ ├── RectangleLayer.cs │ │ └── RectangleShape.cs │ ├── Themes │ ├── Default.xaml │ └── Generic.xaml │ ├── View │ ├── ImageCore.xaml │ └── ImageCore.xaml.cs │ ├── nuget-package.bat │ └── nuget-push.bat └── UserControl └── HeBianGu.Control.ImagePlayer ├── HeBianGu.Control.ImagePlayer.csproj ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── Themes ├── Default.xaml └── Generic.xaml ├── View ├── ImagePlayer.xaml └── ImagePlayer.xaml.cs └── packages.config /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.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 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WPF-ImagePlayer 2 | -------------------------------------------------------------------------------- /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/Application/HeBianGu.App.Demo.ImageCore/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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/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/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/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/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.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.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/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.ImageCore/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Source/Application/HeBianGu.App.Demo.ImagePlayer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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/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/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/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/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.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 | -------------------------------------------------------------------------------- /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/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/Application/HeBianGu.App.Demo.ImagePlayer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Source/Application/HeBianGu.App.Demo.ImagePlayer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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/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/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/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/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/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/General/HeBianGu.General.ImageCore/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /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/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/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/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/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/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/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/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/Mark/MaskCanvas.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 | using System.Windows.Input; 8 | using System.Windows.Media; 9 | 10 | namespace HeBianGu.General.ImageCore 11 | { 12 | public class MaskCanvas : Canvas 13 | { 14 | public MaskCanvas() 15 | { 16 | //Loaded += OnLoaded; 17 | 18 | maskRectLeft.Fill = maskRectRight.Fill = maskRectTop.Fill = maskRectBottom.Fill = MaskWindowBackground; 19 | 20 | SetLeft(maskRectLeft, 0); 21 | SetTop(maskRectLeft, 0); 22 | SetRight(maskRectRight, 0); 23 | SetTop(maskRectRight, 0); 24 | SetTop(maskRectTop, 0); 25 | SetBottom(maskRectBottom, 0); 26 | maskRectLeft.Height = ActualHeight; 27 | 28 | Children.Add(maskRectLeft); 29 | Children.Add(maskRectRight); 30 | Children.Add(maskRectTop); 31 | Children.Add(maskRectBottom); 32 | 33 | selectionBorder.Stroke = SelectionBorderBrush; 34 | selectionBorder.StrokeThickness = 1; 35 | 36 | Children.Add(selectionBorder); 37 | 38 | Indicator = new IndicatorObject(this); 39 | Indicator.Visibility = System.Windows.Visibility.Hidden; 40 | Indicator.Background = Brushes.Transparent; 41 | Children.Add(Indicator); 42 | 43 | CompositionTarget.Rendering += OnCompositionTargetRendering; 44 | } 45 | 46 | public System.Windows.Media.Brush SelectionBorderBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)); 47 | public Thickness SelectionBorderThickness = new Thickness(1); 48 | 49 | //public System.Windows.Media.Brush MaskWindowBackground = new SolidColorBrush(System.Windows.Media.Color.FromArgb(5, 0, 0, 0)); 50 | 51 | public System.Windows.Media.Brush MaskWindowBackground = new SolidColorBrush(Colors.Black) { Opacity = 0.5 }; 52 | 53 | public event EventHandler LoationChanged; 54 | 55 | private void OnLoaded(object sender, RoutedEventArgs e) 56 | { 57 | maskRectLeft.Fill = maskRectRight.Fill = maskRectTop.Fill = maskRectBottom.Fill = MaskWindowBackground; 58 | 59 | SetLeft(maskRectLeft, 0); 60 | SetTop(maskRectLeft, 0); 61 | SetRight(maskRectRight, 0); 62 | SetTop(maskRectRight, 0); 63 | SetTop(maskRectTop, 0); 64 | SetBottom(maskRectBottom, 0); 65 | maskRectLeft.Height = ActualHeight; 66 | 67 | Children.Add(maskRectLeft); 68 | Children.Add(maskRectRight); 69 | Children.Add(maskRectTop); 70 | Children.Add(maskRectBottom); 71 | 72 | selectionBorder.Stroke = SelectionBorderBrush; 73 | selectionBorder.StrokeThickness = 1; 74 | 75 | Children.Add(selectionBorder); 76 | 77 | Indicator = new IndicatorObject(this); 78 | Indicator.Visibility = System.Windows.Visibility.Hidden; 79 | Indicator.Background = Brushes.Transparent; 80 | Children.Add(Indicator); 81 | 82 | CompositionTarget.Rendering += OnCompositionTargetRendering; 83 | 84 | 85 | 86 | } 87 | 88 | private void UpdateSelectionBorderLayout() 89 | { 90 | if (!selectionRegion.IsEmpty) 91 | { 92 | SetLeft(selectionBorder, selectionRegion.Left); 93 | SetTop(selectionBorder, selectionRegion.Top); 94 | selectionBorder.Width = selectionRegion.Width; 95 | selectionBorder.Height = selectionRegion.Height; 96 | } 97 | } 98 | 99 | private void UpdateMaskRectanglesLayout() 100 | { 101 | var actualHeight = ActualHeight; 102 | var actualWidth = ActualWidth; 103 | 104 | if (selectionRegion.IsEmpty) 105 | { 106 | SetLeft(maskRectLeft, 0); 107 | SetTop(maskRectLeft, 0); 108 | maskRectLeft.Width = actualWidth; 109 | maskRectLeft.Height = actualHeight; 110 | 111 | maskRectRight.Width = maskRectRight.Height = maskRectTop.Width = maskRectTop.Height = maskRectBottom.Width = maskRectBottom.Height = 0; 112 | } 113 | else 114 | { 115 | var temp = selectionRegion.Left; 116 | 117 | SetLeft(maskRectLeft, 0); 118 | SetTop(maskRectLeft, 0); 119 | maskRectLeft.Width = actualWidth; 120 | maskRectLeft.Height = actualHeight; 121 | //maskRectRight.Width = maskRectRight.Height = maskRectTop.Width = maskRectTop.Height = maskRectBottom.Width = maskRectBottom.Height = 0; 122 | 123 | 124 | if (maskRectLeft.Width != temp) 125 | { 126 | maskRectLeft.Width = temp < 0 ? 0 : temp; //Math.Max(0, selectionRegion.Left); 127 | } 128 | 129 | temp = ActualWidth - selectionRegion.Right; 130 | if (maskRectRight.Width != temp) 131 | { 132 | maskRectRight.Width = temp < 0 ? 0 : temp; //Math.Max(0, ActualWidth - selectionRegion.Right); 133 | } 134 | 135 | if (maskRectRight.Height != actualHeight) 136 | { 137 | maskRectRight.Height = actualHeight; 138 | } 139 | 140 | SetLeft(maskRectTop, maskRectLeft.Width); 141 | SetLeft(maskRectBottom, maskRectLeft.Width); 142 | 143 | temp = actualWidth - maskRectLeft.Width - maskRectRight.Width+0.2; 144 | maskRectTop.Margin = new Thickness(-0.1, 0, 0, 0); 145 | if (maskRectTop.Width != temp) 146 | { 147 | maskRectTop.Width = temp < 0 ? 0 : temp; //Math.Max(0, ActualWidth - maskRectLeft.Width - maskRectRight.Width); 148 | 149 | } 150 | 151 | temp = selectionRegion.Top; 152 | 153 | if (maskRectTop.Height != temp) 154 | { 155 | maskRectTop.Height = temp < 0 ? 0 : temp; //Math.Max(0, selectionRegion.Top); 156 | } 157 | 158 | maskRectBottom.Width = maskRectTop.Width; 159 | 160 | temp = actualHeight - selectionRegion.Bottom + 0.2; 161 | maskRectBottom.Margin = new Thickness(-0.1, 0, 0, 0); 162 | if (maskRectBottom.Height != temp) 163 | { 164 | maskRectBottom.Height = temp < 0 ? 0 : temp; //Math.Max(0, ActualHeight - selectionRegion.Bottom); 165 | 166 | } 167 | } 168 | } 169 | 170 | 171 | #region Fileds & Props 172 | private Rect selectionRegion = Rect.Empty; 173 | private bool isMaskDraging; 174 | public bool MoveState = false; 175 | private IndicatorObject indicator; 176 | private System.Windows.Point? selectionStartPoint; 177 | private System.Windows.Point? selectionEndPoint; 178 | 179 | private readonly System.Windows.Shapes.Rectangle selectionBorder = new System.Windows.Shapes.Rectangle(); 180 | 181 | private readonly System.Windows.Shapes.Rectangle maskRectLeft = new System.Windows.Shapes.Rectangle(); 182 | private readonly System.Windows.Shapes.Rectangle maskRectRight = new System.Windows.Shapes.Rectangle(); 183 | private readonly System.Windows.Shapes.Rectangle maskRectTop = new System.Windows.Shapes.Rectangle(); 184 | private readonly System.Windows.Shapes.Rectangle maskRectBottom = new System.Windows.Shapes.Rectangle(); 185 | 186 | 187 | public System.Drawing.Size? DefaultSize 188 | { 189 | get; 190 | set; 191 | } 192 | internal IndicatorObject Indicator { get => indicator; set => indicator = value; } 193 | #endregion 194 | 195 | #region Mouse Managment 196 | 197 | private bool IsMouseOnThis(RoutedEventArgs e) 198 | { 199 | return e.Source.Equals(this) || e.Source.Equals(maskRectLeft) || e.Source.Equals(maskRectRight) || e.Source.Equals(maskRectTop) || e.Source.Equals(maskRectBottom); 200 | } 201 | 202 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) 203 | { 204 | Indicator.Visibility = System.Windows.Visibility.Visible; 205 | 206 | if (e.Source.Equals(Indicator)) 207 | { 208 | HandleIndicatorMouseDown(e); 209 | } 210 | else 211 | { 212 | var mouse = e.GetPosition(this); 213 | 214 | this.Indicator.MoveCenter(mouse); 215 | } 216 | base.OnMouseLeftButtonDown(e); 217 | } 218 | 219 | protected override void OnMouseMove(MouseEventArgs e) 220 | { 221 | 222 | System.Diagnostics.Debug.WriteLine(DateTime.Now + "OnMouseMove"); 223 | 224 | if (IsMouseOnThis(e)) 225 | { 226 | UpdateSelectionRegion(e, UpdateMaskType.ForMouseMoving); 227 | 228 | e.Handled = true; 229 | } 230 | 231 | this.UpdateDynimicRect(); 232 | 233 | base.OnMouseMove(e); 234 | 235 | } 236 | 237 | void UpdateDynimicRect() 238 | { 239 | // Message:移动区域 240 | if (this.mouseXY != null && this.MoveState) 241 | { 242 | var position = Mouse.GetPosition(this); 243 | Point transform = new Point(); 244 | transform.X -= mouseXY.X - position.X; 245 | transform.Y -= mouseXY.Y - position.Y; 246 | mouseXY = position; 247 | 248 | this.Indicator.Move(transform); 249 | } 250 | } 251 | 252 | protected override void OnMouseLeave(MouseEventArgs e) 253 | { 254 | HandleIndicatorMouseUp(e); 255 | 256 | System.Diagnostics.Debug.WriteLine("OnMouseLeave"); 257 | 258 | base.OnMouseLeave(e); 259 | } 260 | 261 | protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) 262 | { 263 | if (IsMouseOnThis(e)) 264 | { 265 | UpdateSelectionRegion(e, UpdateMaskType.ForMouseLeftButtonUp); 266 | 267 | FinishShowMask(); 268 | 269 | 270 | } 271 | 272 | HandleIndicatorMouseUp(e); 273 | 274 | base.OnMouseLeftButtonUp(e); 275 | } 276 | 277 | protected override void OnMouseRightButtonUp(MouseButtonEventArgs e) 278 | { 279 | Indicator.Visibility = Visibility.Collapsed; 280 | selectionRegion = Rect.Empty; 281 | selectionBorder.Width = selectionBorder.Height = 0; 282 | // ClearSelectionData(); 283 | UpdateMaskRectanglesLayout(); 284 | 285 | base.OnMouseRightButtonUp(e); 286 | } 287 | 288 | 289 | internal void HandleIndicatorMouseDown(MouseButtonEventArgs e) 290 | { 291 | MoveState = true; 292 | 293 | mouseXY = e.GetPosition(this); 294 | 295 | 296 | System.Diagnostics.Debug.WriteLine("HandleIndicatorMouseDown"); 297 | 298 | } 299 | 300 | internal void HandleIndicatorMouseUp(MouseEventArgs e) 301 | { 302 | MoveState = false; 303 | 304 | System.Diagnostics.Debug.WriteLine("HandleIndicatorMouseUp"); 305 | } 306 | 307 | private void PrepareShowMask(System.Drawing.Point mouseLoc) 308 | { 309 | Indicator.Visibility = Visibility.Collapsed; 310 | selectionBorder.Visibility = Visibility.Visible; 311 | 312 | } 313 | 314 | private void UpdateSelectionRegion() 315 | { 316 | var startPoint = new System.Drawing.Point(0, 0); 317 | var endPoint = new System.Drawing.Point(190, 130); 318 | var sX = startPoint.X; 319 | var sY = startPoint.Y; 320 | var eX = endPoint.X; 321 | var eY = endPoint.Y; 322 | 323 | var deltaX = eX - sX; 324 | var deltaY = eY - sY; 325 | 326 | if (Math.Abs(deltaX) >= SystemParameters.MinimumHorizontalDragDistance || 327 | Math.Abs(deltaX) >= SystemParameters.MinimumVerticalDragDistance) 328 | { 329 | 330 | double x = sX < eX ? sX : eX;//Math.Min(sX, eX); 331 | double y = sY < eY ? sY : eY;//Math.Min(sY, eY); 332 | double w = deltaX < 0 ? -deltaX : deltaX;//Math.Abs(deltaX); 333 | double h = deltaY < 0 ? -deltaY : deltaY;//Math.Abs(deltaY); 334 | 335 | selectionRegion = new Rect(x, y, w, h); 336 | } 337 | else 338 | { 339 | selectionRegion = new Rect(startPoint.X, startPoint.Y, DefaultSize.Value.Width, DefaultSize.Value.Height); 340 | } 341 | } 342 | 343 | Point mouseXY; 344 | private void UpdateSelectionRegion(MouseEventArgs e, UpdateMaskType updateType) 345 | { 346 | if (updateType == UpdateMaskType.ForMouseMoving && e.LeftButton != MouseButtonState.Pressed) 347 | { 348 | selectionStartPoint = null; 349 | } 350 | 351 | if (selectionStartPoint.HasValue) 352 | { 353 | selectionEndPoint = e.GetPosition(this); 354 | 355 | var startPoint = (System.Windows.Point)selectionEndPoint; 356 | var endPoint = (System.Windows.Point)selectionStartPoint; 357 | var sX = startPoint.X; 358 | var sY = startPoint.Y; 359 | var eX = endPoint.X; 360 | var eY = endPoint.Y; 361 | 362 | var deltaX = eX - sX; 363 | var deltaY = eY - sY; 364 | 365 | if (Math.Abs(deltaX) >= SystemParameters.MinimumHorizontalDragDistance || 366 | Math.Abs(deltaX) >= SystemParameters.MinimumVerticalDragDistance) 367 | { 368 | isMaskDraging = true; 369 | 370 | double x = sX < eX ? sX : eX;//Math.Min(sX, eX); 371 | double y = sY < eY ? sY : eY;//Math.Min(sY, eY); 372 | double w = deltaX < 0 ? -deltaX : deltaX;//Math.Abs(deltaX); 373 | double h = deltaY < 0 ? -deltaY : deltaY;//Math.Abs(deltaY); 374 | 375 | selectionRegion = new Rect(x, y, w, h); 376 | } 377 | else 378 | { 379 | if (DefaultSize.HasValue && updateType == UpdateMaskType.ForMouseLeftButtonUp) 380 | { 381 | isMaskDraging = true; 382 | 383 | selectionRegion = new Rect(startPoint.X, startPoint.Y, DefaultSize.Value.Width, DefaultSize.Value.Height); 384 | } 385 | else 386 | { 387 | isMaskDraging = false; 388 | } 389 | } 390 | } 391 | 392 | UpdateIndicator(selectionRegion); 393 | } 394 | 395 | internal void UpdateSelectionRegion(Rect region, bool flag = false) 396 | { 397 | if (!flag && this.MoveState) return; 398 | 399 | selectionRegion = region; 400 | 401 | UpdateIndicator(selectionRegion); 402 | 403 | if (LoationChanged != null && flag) 404 | { 405 | 406 | 407 | LoationChanged(this, new LoactionArgs(region.Left / this.Width, region.Top / this.Height)); 408 | } 409 | } 410 | 411 | 412 | private void FinishShowMask() 413 | { 414 | if (IsMouseCaptured) 415 | { 416 | ReleaseMouseCapture(); 417 | } 418 | 419 | if (isMaskDraging) 420 | { 421 | 422 | UpdateIndicator(selectionRegion); 423 | 424 | ClearSelectionData(); 425 | } 426 | } 427 | 428 | private void ClearSelectionData() 429 | { 430 | isMaskDraging = false; 431 | selectionBorder.Visibility = Visibility.Collapsed; 432 | selectionStartPoint = null; 433 | selectionEndPoint = null; 434 | } 435 | 436 | private void UpdateIndicator(Rect region) 437 | { 438 | 439 | //System.Diagnostics.Debug.WriteLine(region.Width); 440 | //System.Diagnostics.Debug.WriteLine(region.Height); 441 | 442 | if (Indicator == null) 443 | return; 444 | 445 | if (region.Width < Indicator.MinWidth || region.Height < Indicator.MinHeight) 446 | { 447 | return; 448 | } 449 | 450 | if (double.IsInfinity(region.Width) ||double.IsInfinity(region.Height)) return; 451 | 452 | Indicator.Visibility = Visibility.Visible; 453 | Indicator.Width = region.Width; 454 | Indicator.Height = region.Height; 455 | SetLeft(Indicator, region.Left); 456 | SetTop(Indicator, region.Top); 457 | 458 | 459 | } 460 | 461 | private Rect GetIndicatorRegion() 462 | { 463 | return new Rect(GetLeft(Indicator), GetTop(Indicator), Indicator.ActualWidth, Indicator.ActualHeight); 464 | } 465 | 466 | #endregion 467 | 468 | #region Render 469 | 470 | private void OnCompositionTargetRendering(object sender, EventArgs e) 471 | { 472 | UpdateSelectionBorderLayout(); 473 | UpdateMaskRectanglesLayout(); 474 | } 475 | 476 | #endregion 477 | 478 | #region inner types 479 | 480 | private enum UpdateMaskType 481 | { 482 | ForMouseMoving, 483 | ForMouseLeftButtonUp 484 | } 485 | 486 | #endregion 487 | 488 | } 489 | 490 | } 491 | -------------------------------------------------------------------------------- /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/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/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/Rectangle/RectangleShape.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.Media; 10 | using System.Windows.Shapes; 11 | 12 | namespace HeBianGu.General.ImageCore 13 | { 14 | 15 | /// 16 | /// 矩形图基类 17 | /// 18 | public class RectangleShape : Shape, IRectangleStroke 19 | { 20 | 21 | public string Code { get; set; } 22 | public string Name { get; set; } 23 | 24 | public double NormalStrokeThickness { get; set; } = 5; 25 | 26 | public double MouseOverStrokeThickness { get; set; } = 8; 27 | 28 | public double SelectedStrokeThickness { get; set; } = 10; 29 | 30 | public double SeletedAndMouseOverStrokeThickness { get; set; } = 15; 31 | /// 32 | /// 无参数构造函数 33 | /// 34 | public RectangleShape() : base() 35 | { 36 | this.InitComponent(); 37 | 38 | this.StrokeThickness = this.NormalStrokeThickness; 39 | } 40 | 41 | void RefreshStrokeThickness() 42 | { 43 | if ((this is DynamicShape)) return; 44 | 45 | if (this.IsSelected) 46 | { 47 | if (this.IsMouseOver) 48 | { 49 | this.StrokeThickness = SeletedAndMouseOverStrokeThickness;// this.NormalStrokeThickness * 5 * 8; 50 | } 51 | else 52 | { 53 | this.StrokeThickness = SelectedStrokeThickness;// this.NormalStrokeThickness * 5 * 5; 54 | } 55 | 56 | this.Fill = new SolidColorBrush() { Color = ((SolidColorBrush)this.Fill).Color, Opacity = 0.5 }; 57 | } 58 | else 59 | { 60 | 61 | this.Fill = new SolidColorBrush() { Color = ((SolidColorBrush)this.Fill).Color, Opacity = 0.2 }; 62 | 63 | if (this.IsMouseOver) 64 | { 65 | this.StrokeThickness = MouseOverStrokeThickness;// this.NormalStrokeThickness * 5 * 3; 66 | } 67 | else 68 | { 69 | this.StrokeThickness = NormalStrokeThickness;// this.NormalStrokeThickness * 5; 70 | } 71 | } 72 | } 73 | 74 | public event Action Selected; 75 | 76 | 77 | public bool IsSelected { get; private set; } 78 | 79 | public void SetSelected() 80 | { 81 | InkCanvas canvas = this.Parent as InkCanvas; 82 | 83 | foreach (var item in canvas.Children) 84 | { 85 | if (item is RectangleShape) 86 | { 87 | RectangleShape shape = item as RectangleShape; 88 | 89 | if (shape.IsSelected) 90 | { 91 | //shape.Fill = new SolidColorBrush() { Color = ((SolidColorBrush)shape.Fill).Color, Opacity = 0.1 }; 92 | //shape.Stroke = new SolidColorBrush() { Color = ((SolidColorBrush)shape.Stroke).Color, Opacity = 1 }; 93 | //shape.StrokeThickness /= 3; 94 | shape.IsSelected = false; 95 | 96 | 97 | Debug.WriteLine("取消选中:"+shape.Code); 98 | 99 | 100 | shape.RefreshStrokeThickness(); 101 | } 102 | } 103 | } 104 | 105 | this.IsSelected = true; 106 | 107 | // Message:触发选中事件 108 | this.Selected?.Invoke(this); 109 | 110 | //this.Fill = new SolidColorBrush() { Color = ((SolidColorBrush)this.Fill).Color, Opacity = 0.7 }; 111 | //this.StrokeThickness *= 3; 112 | Debug.WriteLine("选中:" + this.Code); 113 | this.RefreshStrokeThickness(); 114 | } 115 | /// 116 | /// 初始化组件 117 | /// 118 | void InitComponent() 119 | { 120 | this.NormalStrokeThickness = this.StrokeThickness; 121 | 122 | 123 | // Do:鼠标进入事件 124 | this.MouseEnter += (l, k) => 125 | { 126 | this.RefreshStrokeThickness(); 127 | }; 128 | 129 | // Do:鼠标移除事件 130 | this.MouseLeave += (l, k) => 131 | { 132 | 133 | this.RefreshStrokeThickness(); 134 | }; 135 | 136 | this.PreviewMouseDown += (l, k) => 137 | { 138 | SetSelected(); 139 | }; 140 | 141 | 142 | } 143 | 144 | /// 145 | /// 构造函数 146 | /// 147 | /// 左上角点 148 | /// 右下角点 149 | public RectangleShape(Point start, Point end) 150 | { 151 | this.InitComponent(); 152 | 153 | this.Width = Math.Abs(start.X - end.X); 154 | this.Height = Math.Abs(start.Y - end.Y); 155 | 156 | Position = new Point(Math.Min(start.X, end.X), Math.Min(start.Y, end.Y)); 157 | 158 | 159 | //Debug.WriteLine(this.Width + "*" + this.Height); 160 | //Debug.WriteLine(Position.X + "*" + Position.Y); 161 | 162 | } 163 | 164 | /// 165 | /// 构造函数 166 | /// 167 | /// 矩形形状 168 | public RectangleShape(RectangleShape rectangle) 169 | { 170 | this.InitComponent(); 171 | 172 | this.Width = rectangle.Width; 173 | this.Height = rectangle.Height; 174 | 175 | this.Position = new Point(rectangle.Position.X, rectangle.Position.Y); 176 | } 177 | 178 | /// 179 | /// 构造函数 180 | /// 181 | /// 左上方 x坐标 182 | /// 左上方 y坐标 183 | /// 宽度 184 | /// 高度 185 | public RectangleShape(double x, double y, double width, double height) 186 | { 187 | this.InitComponent(); 188 | 189 | this.Width = width; 190 | this.Height = height; 191 | 192 | this.Position = new Point(x, y); 193 | } 194 | 195 | 196 | /// 197 | /// 左上方点坐标 198 | /// 199 | public Point Position { get; set; } 200 | 201 | /// 202 | /// 矩形区域形状 203 | /// 204 | public Rect Rect 205 | { 206 | get 207 | { 208 | return new Rect(this.Position, new Size(this.Width, 209 | this.Height)); 210 | } 211 | } 212 | 213 | /// 214 | /// 定义模型 215 | /// 216 | protected override Geometry DefiningGeometry 217 | { 218 | get 219 | { 220 | RectangleGeometry geo = new RectangleGeometry(); 221 | 222 | geo.Rect = new Rect(new Point(0, 0), new Size(this.Width, 223 | this.Height)); 224 | return geo; 225 | } 226 | } 227 | 228 | /// 229 | /// 渲染模型 230 | /// 231 | public override Geometry RenderedGeometry 232 | { 233 | get 234 | { 235 | RectangleGeometry geo = new RectangleGeometry(); 236 | 237 | geo.Rect = new Rect(new Point(0, 0), new Size(this.Width, 238 | this.Height)); 239 | return geo; 240 | } 241 | } 242 | 243 | /// 244 | /// 绘制图形 245 | /// 246 | /// 247 | public virtual void Draw(InkCanvas canvas) 248 | { 249 | InkCanvas.SetLeft(this, Position.X); 250 | InkCanvas.SetTop(this, Position.Y); 251 | canvas.Children.Add(this); 252 | } 253 | 254 | /// 255 | /// 清理图形 256 | /// 257 | /// 258 | public void Clear(InkCanvas canvas) 259 | { 260 | canvas.Children.Remove(this); 261 | } 262 | 263 | public void Clear() 264 | { 265 | InkCanvas canvas = this.Parent as InkCanvas; 266 | 267 | canvas.Children.Remove(this); 268 | } 269 | } 270 | 271 | public class DataRectangleShape : RectangleShape 272 | { 273 | #region - 构造函数 - 274 | /// 275 | /// 构造函数 276 | /// 277 | public DataRectangleShape() : base() 278 | { 279 | 280 | } 281 | 282 | /// 283 | /// 构造函数 284 | /// 285 | public DataRectangleShape(Point start, Point end) : base(start, end) 286 | { 287 | 288 | } 289 | 290 | /// 291 | /// 构造函数 292 | /// 293 | public DataRectangleShape(RectangleShape rectangle) : base(rectangle) 294 | { 295 | 296 | } 297 | 298 | /// 299 | /// 构造函数 300 | /// 301 | public DataRectangleShape(double x, double y, double width, double height) : base(x, y, width, height) 302 | { 303 | 304 | } 305 | #endregion 306 | 307 | } 308 | 309 | 310 | /// 311 | /// 动态变换的矩形形状 312 | /// 313 | public class DynamicShape : RectangleShape 314 | { 315 | /// 316 | /// 构造函数 317 | /// 318 | public DynamicShape() : base() 319 | { 320 | 321 | } 322 | 323 | /// 324 | /// 构造函数 325 | /// 326 | /// 327 | /// 328 | public DynamicShape(Point start, Point end) : base(start, end) 329 | { 330 | 331 | } 332 | 333 | /// 334 | /// 构造函数 335 | /// 336 | /// 337 | public DynamicShape(RectangleShape rectangle) : base(rectangle) 338 | { 339 | 340 | } 341 | 342 | /// 343 | /// 构造函数 344 | /// 345 | /// 346 | /// 347 | /// 348 | /// 349 | public DynamicShape(double x, double y, double width, double height) : base(x, y, width, height) 350 | { 351 | 352 | } 353 | 354 | /// 355 | /// 鼠标移动时刷新图形 356 | /// 357 | /// 358 | /// 359 | public void Refresh(Point start, Point end) 360 | { 361 | 362 | 363 | 364 | this.Width = Math.Abs(start.X - end.X); 365 | this.Height = Math.Abs(start.Y - end.Y); 366 | 367 | this.Position = new Point(Math.Min(start.X, end.X), Math.Min(start.Y, end.Y)); 368 | InkCanvas.SetLeft(this, Position.X); 369 | InkCanvas.SetTop(this, Position.Y); 370 | 371 | //Debug.WriteLine(this.Width + "*" + this.Height); 372 | //Debug.WriteLine(Position.X + "*" + Position.Y); 373 | } 374 | 375 | 376 | /// 377 | /// 匹配的高度 378 | /// 379 | public int HeightMatch 380 | { 381 | get { return (int)GetValue(HeightMatchProperty); } 382 | set { SetValue(HeightMatchProperty, value); } 383 | } 384 | 385 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 386 | public static readonly DependencyProperty HeightMatchProperty = 387 | DependencyProperty.Register("HeightMatch", typeof(int), typeof(DynamicShape), new PropertyMetadata(10, (d, e) => 388 | { 389 | DynamicShape control = d as DynamicShape; 390 | 391 | if (control == null) return; 392 | 393 | //int config = e.NewValue as int; 394 | 395 | })); 396 | 397 | 398 | /// 399 | /// 匹配的宽度 400 | /// 401 | public int WidthMatch 402 | { 403 | get { return (int)GetValue(WidthMatchProperty); } 404 | set { SetValue(WidthMatchProperty, value); } 405 | } 406 | 407 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 408 | public static readonly DependencyProperty WidthMatchProperty = 409 | DependencyProperty.Register("WidthMatch", typeof(int), typeof(DynamicShape), new PropertyMetadata(10, (d, e) => 410 | { 411 | DynamicShape control = d as DynamicShape; 412 | 413 | if (control == null) return; 414 | 415 | //int config = e.NewValue as int; 416 | 417 | })); 418 | 419 | 420 | /// 421 | /// 是否匹配 422 | /// 423 | /// 424 | public bool IsMatch() 425 | { 426 | return _initFlag && this.Width > this.WidthMatch && this.Height > this.HeightMatch; 427 | } 428 | 429 | bool _initFlag = false; 430 | 431 | /// 432 | /// 通过_initFlag标识是否开始计算匹配 433 | /// 434 | /// 435 | public void BegionMatch(bool flag) 436 | { 437 | this.Width = 0; 438 | this.Height = 0; 439 | _initFlag = flag; 440 | } 441 | 442 | } 443 | 444 | /// 445 | /// 缺陷形状 446 | /// 447 | public class DefectShape : DataRectangleShape 448 | { 449 | /// 450 | /// 构造函数 451 | /// 452 | public DefectShape() : base() 453 | { 454 | 455 | } 456 | 457 | /// 458 | /// 构造函数 459 | /// 460 | public DefectShape(Point start, Point end) : base(start, end) 461 | { 462 | 463 | } 464 | 465 | /// 466 | /// 构造函数 467 | /// 468 | public DefectShape(RectangleShape rectangle) : base(rectangle) 469 | { 470 | 471 | } 472 | 473 | /// 474 | /// 构造函数 475 | /// 476 | public DefectShape(double x, double y, double width, double height) : base(x, y, width, height) 477 | { 478 | 479 | } 480 | } 481 | 482 | /// 483 | /// 样本形状 484 | /// 485 | public class SampleShape : DataRectangleShape 486 | { 487 | /// 488 | /// 构造函数 489 | /// 490 | public SampleShape() : base() 491 | { 492 | 493 | } 494 | 495 | /// 496 | /// 构造函数 497 | /// 498 | public SampleShape(Point start, Point end) : base(start, end) 499 | { 500 | 501 | } 502 | 503 | /// 504 | /// 构造函数 505 | /// 506 | public SampleShape(RectangleShape rectangle) : base(rectangle) 507 | { 508 | 509 | } 510 | 511 | /// 512 | /// 构造函数 513 | /// 514 | public SampleShape(double x, double y, double width, double height) : base(x, y, width, height) 515 | { 516 | 517 | } 518 | } 519 | 520 | } 521 | -------------------------------------------------------------------------------- /Source/General/HeBianGu.General.ImageCore/Themes/Default.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 9 | 10 | 27 | 28 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Source/General/HeBianGu.General.ImageCore/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Source/General/HeBianGu.General.ImageCore/View/ImageCore.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Source/General/HeBianGu.General.ImageCore/View/ImageCore.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Controls; 11 | using System.Windows.Data; 12 | using System.Windows.Documents; 13 | using System.Windows.Input; 14 | using System.Windows.Media; 15 | using System.Windows.Media.Imaging; 16 | using System.Windows.Navigation; 17 | using System.Windows.Shapes; 18 | using System.Windows.Threading; 19 | 20 | namespace HeBianGu.General.ImageCore 21 | { 22 | [TemplatePart(Name = "PART_CenterCanvas", Type = typeof(InkCanvas))] 23 | [TemplatePart(Name = "PART_ImageCenter", Type = typeof(Image))] 24 | [TemplatePart(Name = "PART_Grid_Mouse_Drag", Type = typeof(ContentControl))] 25 | [TemplatePart(Name = "PART_ScrollView_Default", Type = typeof(ScrollViewer))] 26 | [TemplatePart(Name = "PART_Grid_Mark", Type = typeof(Grid))] 27 | [TemplatePart(Name = "PART_ViewBox_Default", Type = typeof(Viewbox))] 28 | [TemplatePart(Name = "PART_Grid_Root", Type = typeof(Grid))] 29 | [TemplatePart(Name = "PART_ContentControl_Mark", Type = typeof(ContentControl))] 30 | [TemplatePart(Name = "PART_MarkCanvas_Mark", Type = typeof(MaskCanvas))] 31 | [TemplatePart(Name = "PART_Grid_Popup", Type = typeof(Grid))] 32 | 33 | // Do :放大镜效果应用 34 | [TemplatePart(Name = "PART_Canvas_BigBox", Type = typeof(Canvas))] 35 | [TemplatePart(Name = "PART_Image_Big", Type = typeof(Image))] 36 | [TemplatePart(Name = "PART_RectangleGeometry_Big", Type = typeof(RectangleGeometry))] 37 | [TemplatePart(Name = "PART_Ecllipse_Move", Type = typeof(Ellipse))] 38 | [TemplatePart(Name = "PART_Grid_All", Type = typeof(Grid))] 39 | 40 | // Do :局部放大效果应用 41 | [TemplatePart(Name = "PART_DynamicShape_Draw", Type = typeof(DynamicShape))] 42 | 43 | public partial class ImageCore : ContentControl 44 | { 45 | static ImageCore() 46 | { 47 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageCore), new FrameworkPropertyMetadata(typeof(ImageCore))); 48 | } 49 | 50 | #region - 内部成员 - 51 | 52 | internal InkCanvas _centerCanvas = null; 53 | 54 | internal Image _imageCenter = null; 55 | 56 | /// 用于鼠标按下拖动图片移动效果 57 | internal ContentControl grid_Mouse_drag = null; 58 | 59 | internal ScrollViewer _svDefault = null; 60 | 61 | internal Grid grid_mark = null; 62 | 63 | internal Viewbox vb = null; 64 | 65 | internal Grid rootGrid = null; 66 | 67 | internal ContentControl controlmask = null; 68 | 69 | internal MaskCanvas mask = null; 70 | 71 | TransformGroup tfGroup; 72 | 73 | internal Grid popup = null; 74 | 75 | internal Canvas BigBox = null; 76 | 77 | internal Image bigImg = null; 78 | 79 | internal RectangleGeometry bigrect = null; 80 | 81 | internal Ellipse MoveRect = null; 82 | 83 | internal Grid grid_all = null; 84 | 85 | internal DynamicShape _dynamic = null; 86 | 87 | 88 | double hOffSetRate = 0;//滚动条横向位置横向百分比 89 | 90 | double vOffSetRate = 0;//滚动条位置纵向百分比 91 | 92 | /// 图片的宽度 93 | internal double imgWidth; 94 | 95 | /// 图片的高度 96 | internal double imgHeight; 97 | 98 | List behaviors = new List(); 99 | 100 | #endregion 101 | 102 | #region - 初始化 - 103 | 104 | public ImageCore() 105 | { 106 | // Do:改变窗口自适应大小 107 | this.SizeChanged += (l, k) => 108 | { 109 | if (this.grid_Mouse_drag == null) return; 110 | 111 | this.SetFullImage(); 112 | 113 | }; 114 | 115 | // Do :绑定菜单命令 116 | CommandBinding command = new CommandBinding(ImageBaseCommands.DefaultCommand, (l, k) => 117 | { 118 | string commond = k.Parameter?.ToString(); 119 | 120 | if (commond == "删除") 121 | { 122 | this.DeleteShape(); 123 | } 124 | else if (commond == "放大") 125 | { 126 | this.ShowShape(); 127 | } 128 | 129 | }); 130 | 131 | this.CommandBindings.Add(command); 132 | 133 | // Do :绑定自定义行为 134 | 135 | this.behaviors.Add(new ImageBaseMouseWheelBehavior(this)); 136 | this.behaviors.Add(new ImageBaseMouseEnlargeBehavior(this)); 137 | this.behaviors.Add(new ImageBaseMouseDragBehavior(this)); 138 | this.behaviors.Add(new ImageBaseMouseSignBehavior(this)); 139 | this.behaviors.Add(new ImageBaseMouseBubbleBehavior(this)); 140 | } 141 | 142 | public override void OnApplyTemplate() 143 | { 144 | base.OnApplyTemplate(); 145 | 146 | this._centerCanvas = Template.FindName("PART_CenterCanvas", this) as InkCanvas; 147 | 148 | this._imageCenter = Template.FindName("PART_ImageCenter", this) as Image; 149 | 150 | grid_Mouse_drag = Template.FindName("PART_Grid_Mouse_Drag", this) as ContentControl; 151 | 152 | _svDefault = Template.FindName("PART_ScrollView_Default", this) as ScrollViewer; 153 | 154 | grid_mark = Template.FindName("PART_Grid_Mark", this) as Grid; 155 | 156 | vb = Template.FindName("PART_ViewBox_Default", this) as Viewbox; 157 | 158 | rootGrid = Template.FindName("PART_Grid_Root", this) as Grid; 159 | 160 | mask = Template.FindName("PART_MarkCanvas_Mark", this) as MaskCanvas; 161 | 162 | controlmask = Template.FindName("PART_ContentControl_Mark", this) as ContentControl; 163 | 164 | popup = Template.FindName("PART_Grid_Popup", this) as Grid; 165 | 166 | BigBox = Template.FindName("PART_Canvas_BigBox", this) as Canvas; 167 | 168 | bigImg = Template.FindName("PART_Image_Big", this) as Image; 169 | 170 | bigrect = Template.FindName("PART_RectangleGeometry_Big", this) as RectangleGeometry; 171 | 172 | grid_all = Template.FindName("PART_Grid_All", this) as Grid; 173 | 174 | MoveRect = Template.FindName("PART_Ecllipse_Move", this) as Ellipse; 175 | 176 | _dynamic = Template.FindName("PART_DynamicShape_Draw", this) as DynamicShape; 177 | 178 | // Do :初始化宽度高度 179 | this.InitWidthHeight(); 180 | 181 | // Do :初始化设置平铺 182 | this.SetFullImage(); 183 | 184 | this.NoticeMessaged += (m, n) => Debug.WriteLine(this.Message); 185 | 186 | this.behaviors.ForEach(l => l.RegisterBehavior()); 187 | } 188 | 189 | #endregion 190 | 191 | #region - 属性 - 192 | /// 滚轮放大倍数 193 | public double WheelScale { get; set; } = 0.5; 194 | 195 | /// 设置最大放大倍数 196 | public int MaxScale { get; set; } = 25; 197 | 198 | #endregion 199 | 200 | [Browsable(false)] 201 | [Category("Appearance")] 202 | [ReadOnly(true)] 203 | public OperateType OperateType 204 | { 205 | get { return (OperateType)GetValue(OperateTypeProperty); } 206 | set { SetValue(OperateTypeProperty, value); } 207 | } 208 | 209 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 210 | public static readonly DependencyProperty OperateTypeProperty = 211 | DependencyProperty.Register("OperateType", typeof(OperateType), typeof(ImageCore), new PropertyMetadata(default(OperateType), (d, e) => 212 | { 213 | ImageCore control = d as ImageCore; 214 | 215 | if (control == null) return; 216 | 217 | OperateType config = (OperateType)e.NewValue; 218 | 219 | })); 220 | 221 | 222 | 223 | 224 | /// 当前图片资源 225 | public ImageSource ImageSource 226 | { 227 | get { return (ImageSource)GetValue(ImageSourceProperty); } 228 | set { SetValue(ImageSourceProperty, value); } 229 | } 230 | 231 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 232 | public static readonly DependencyProperty ImageSourceProperty = 233 | DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ImageCore), new PropertyMetadata(default(ImageSource), (d, e) => 234 | { 235 | ImageCore control = d as ImageCore; 236 | 237 | if (control == null) return; 238 | 239 | ImageSource config = e.NewValue as ImageSource; 240 | 241 | if (control.grid_Mouse_drag == null) return; 242 | 243 | control.SetFullImage(); 244 | 245 | 246 | })); 247 | 248 | 249 | /// 设置放大倍数 250 | public double Scale 251 | { 252 | get { return (double)GetValue(ScaleProperty); } 253 | set { SetValue(ScaleProperty, value); } 254 | } 255 | 256 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 257 | public static readonly DependencyProperty ScaleProperty = 258 | DependencyProperty.Register("Scale", typeof(double), typeof(ImageCore), new PropertyMetadata(1.0, (d, e) => 259 | { 260 | ImageCore control = d as ImageCore; 261 | 262 | if (control == null) return; 263 | 264 | double config = (double)e.NewValue; 265 | 266 | control.Scale = config < 0 ? 0 : config; 267 | 268 | control.RefreshImageByScale(); 269 | 270 | })); 271 | 272 | /// 是否放到最大 273 | public bool IsMaxScaled 274 | { 275 | get { return (bool)GetValue(IsMaxScaledProperty); } 276 | set { SetValue(IsMaxScaledProperty, value); } 277 | } 278 | 279 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 280 | public static readonly DependencyProperty IsMaxScaledProperty = 281 | DependencyProperty.Register("IsMaxScaled", typeof(bool), typeof(ImageCore), new PropertyMetadata(default(bool), (d, e) => 282 | { 283 | ImageCore control = d as ImageCore; 284 | 285 | if (control == null) return; 286 | 287 | //bool config = e.NewValue as bool; 288 | 289 | })); 290 | 291 | /// 是否放到最小 292 | public bool IsMinScaled 293 | { 294 | get { return (bool)GetValue(IsMinScaledProperty); } 295 | set { SetValue(IsMinScaledProperty, value); } 296 | } 297 | 298 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 299 | public static readonly DependencyProperty IsMinScaledProperty = 300 | DependencyProperty.Register("IsMinScaled", typeof(bool), typeof(ImageCore), new PropertyMetadata(default(bool), (d, e) => 301 | { 302 | ImageCore control = d as ImageCore; 303 | 304 | if (control == null) return; 305 | 306 | //bool config = e.NewValue as bool; 307 | 308 | })); 309 | 310 | 311 | /// 交互消息 312 | public string Message 313 | { 314 | get { return (string)GetValue(MessageProperty); } 315 | set { SetValue(MessageProperty, value); } 316 | } 317 | 318 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 319 | public static readonly DependencyProperty MessageProperty = 320 | DependencyProperty.Register("Message", typeof(string), typeof(ImageCore), new PropertyMetadata(default(string), (d, e) => 321 | { 322 | ImageCore control = d as ImageCore; 323 | 324 | if (control == null) return; 325 | 326 | string config = e.NewValue as string; 327 | 328 | })); 329 | 330 | 331 | 332 | //声明和注册路由事件 333 | public static readonly RoutedEvent NoticeMessagedRoutedEvent = 334 | EventManager.RegisterRoutedEvent("NoticeMessaged", RoutingStrategy.Bubble, typeof(EventHandler), typeof(ImageCore)); 335 | //CLR事件包装 336 | public event RoutedEventHandler NoticeMessaged 337 | { 338 | add { this.AddHandler(NoticeMessagedRoutedEvent, value); } 339 | remove { this.RemoveHandler(NoticeMessagedRoutedEvent, value); } 340 | } 341 | 342 | //激发路由事件,借用Click事件的激发方法 343 | 344 | internal void OnNoticeMessaged(string message) 345 | { 346 | this.Message = message; 347 | 348 | RoutedEventArgs args = new RoutedEventArgs(NoticeMessagedRoutedEvent, this); 349 | 350 | this.RaiseEvent(args); 351 | } 352 | #region - 通用方法 - 353 | 354 | /// 当初始化时初始化图片的宽和高 355 | void InitWidthHeight() 356 | { 357 | this.UpdateLayout(); 358 | 359 | imgWidth = this.grid_Mouse_drag.ActualWidth; 360 | imgHeight = this.grid_Mouse_drag.ActualHeight; 361 | 362 | // Message:修改旋转后的图片宽高显示方式 363 | if (tfGroup != null) 364 | { 365 | var rotate = tfGroup.Children[2] as RotateTransform; 366 | 367 | if (rotate.Angle % 180 == 0) 368 | { 369 | imgWidth = this.grid_Mouse_drag.ActualWidth; 370 | imgHeight = this.grid_Mouse_drag.ActualHeight; 371 | } 372 | else 373 | { 374 | imgHeight = this.grid_Mouse_drag.ActualWidth; 375 | imgWidth = this.grid_Mouse_drag.ActualWidth; 376 | } 377 | } 378 | } 379 | 380 | /// 设置初始图片为平铺整个控件 381 | internal void SetFullImage() 382 | { 383 | this.InitWidthHeight(); 384 | 385 | if (imgWidth == 0 || imgHeight == 0) 386 | return; 387 | 388 | //SetbtnActualsizeEnable(); 389 | 390 | //btnNarrow.IsEnabled = false; 391 | 392 | this.IsMinScaled = true; 393 | 394 | RefreshImageByScale(); 395 | 396 | Scale = this.GetFullScale(); 397 | 398 | //this.txtZoom.Text = ((int)(Scale * 100)).ToString() + "%"; 399 | 400 | this.OnNoticeMessaged(((int)(Scale * 100)).ToString() + "%"); 401 | } 402 | 403 | /// 当Scale改变时刷新图片大小 404 | internal void RefreshImageByScale() 405 | { 406 | GetOffSetRate(); 407 | 408 | if (imgWidth < 0 || imgHeight < 0) return; 409 | 410 | vb.Width = Scale * imgWidth; 411 | vb.Height = Scale * imgHeight; 412 | 413 | SetOffSetByRate(); 414 | 415 | this.RefreshMarkVisible(); 416 | } 417 | 418 | 419 | /// 当Scale变化时设置更新后水平和垂直位移 420 | internal void SetOffSetByRate() 421 | { 422 | this.UpdateLayout(); 423 | 424 | if (_svDefault.ScrollableWidth > 0) 425 | { 426 | double hOffSet = hOffSetRate * _svDefault.ScrollableWidth; 427 | _svDefault.ScrollToHorizontalOffset(hOffSet); 428 | } 429 | if (_svDefault.ScrollableHeight > 0) 430 | { 431 | double vOffSet = vOffSetRate * _svDefault.ScrollableHeight; 432 | _svDefault.ScrollToVerticalOffset(vOffSet); 433 | } 434 | } 435 | 436 | /// 获取适应屏幕大小的范围 437 | public double GetFullScale() 438 | { 439 | double result = _svDefault.ActualWidth / imgWidth; 440 | 441 | result = Math.Min(result, _svDefault.ActualHeight / imgHeight); 442 | 443 | return result; 444 | 445 | } 446 | 447 | /// 当Scale变化时获取更新前水平和垂直位移 448 | internal void GetOffSetRate() 449 | { 450 | if (_svDefault.ScrollableWidth > 0) 451 | { 452 | if (_svDefault.HorizontalOffset != 0) 453 | hOffSetRate = _svDefault.HorizontalOffset / _svDefault.ScrollableWidth; 454 | } 455 | if (_svDefault.ScrollableHeight > 0) 456 | { 457 | if (_svDefault.VerticalOffset != 0) 458 | vOffSetRate = _svDefault.VerticalOffset / _svDefault.ScrollableHeight; 459 | } 460 | } 461 | 462 | /// 根据Scale放大倍数设置鸟撖图是否可见 463 | internal void RefreshMarkVisible() 464 | { 465 | if (imgWidth == 0 || imgHeight == 0) return; 466 | 467 | if (Scale > Math.Min(_svDefault.ActualWidth / imgWidth, _svDefault.ActualHeight / imgHeight)) 468 | { 469 | this.grid_mark.Visibility = Visibility.Visible; 470 | } 471 | else 472 | { 473 | this.grid_mark.Visibility = Visibility.Collapsed; 474 | } 475 | } 476 | 477 | #endregion 478 | 479 | 480 | 481 | public ObservableCollection RectangleShapes 482 | { 483 | get { return (ObservableCollection)GetValue(RectangleShapesProperty); } 484 | set { SetValue(RectangleShapesProperty, value); } 485 | } 486 | 487 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 488 | public static readonly DependencyProperty RectangleShapesProperty = 489 | DependencyProperty.Register("RectangleShapes", typeof(ObservableCollection), typeof(ImageCore), new PropertyMetadata(new ObservableCollection(), (d, e) => 490 | { 491 | ImageCore control = d as ImageCore; 492 | 493 | if (control == null) return; 494 | 495 | ObservableCollection config = e.NewValue as ObservableCollection; 496 | 497 | })); 498 | 499 | 500 | 501 | internal void AddShape(Rect rect) 502 | { 503 | SampleShape resultStroke = new SampleShape(this._dynamic); 504 | resultStroke.Name = DateTime.Now.ToString(); 505 | resultStroke.Code = DateTime.Now.ToString(); 506 | resultStroke.Draw(this._centerCanvas); 507 | this.RectangleShapes.Add(resultStroke); 508 | 509 | //// Do:清除动态框 510 | //_dynamic.BegionMatch(false); 511 | } 512 | 513 | void DeleteShape() 514 | { 515 | var find = this.RectangleShapes.FirstOrDefault(l => l.IsSelected); 516 | 517 | if (find == null) return; 518 | 519 | this._centerCanvas.Children.Remove(find); 520 | 521 | this.RectangleShapes.Remove(find); 522 | } 523 | 524 | void ShowShape() 525 | { 526 | var find = this.RectangleShapes.FirstOrDefault(l => l.IsSelected); 527 | 528 | if (find == null) return; 529 | 530 | this.ShowShape(find.Rect); 531 | } 532 | 533 | /// 按矩形框放大 534 | internal void ShowShape(Rect rect) 535 | { 536 | if (this.imgWidth == 0 || this.imgHeight == 0) 537 | return; 538 | 539 | double percentX = rect.X / this._centerCanvas.ActualWidth; 540 | 541 | double percentY = rect.Y / this._centerCanvas.ActualHeight; 542 | 543 | double timeW = rect.Width / this._centerCanvas.ActualWidth; 544 | double timeH = rect.Height / this._centerCanvas.ActualHeight; 545 | 546 | double w = this.mask.ActualWidth * timeW; 547 | double h = this.mask.ActualHeight * timeH; 548 | 549 | 550 | // Message:设置缩放比例 551 | this.Scale = Math.Min(this._svDefault.ActualWidth / this.imgWidth, this._svDefault.ActualHeight / this.imgHeight); 552 | 553 | this.Scale = this.Scale / Math.Max(timeW, timeH); 554 | 555 | //this.txtZoom.Text = ((int)(Scale * 100)).ToString() + "%"; 556 | 557 | //if (sb_Tip != null) sb_Tip.Begin(); 558 | 559 | 560 | 561 | double indicatorWidth = mask.Indicator.ActualWidth / mask.ActualWidth; 562 | double indicatorHeight = mask.Indicator.ActualHeight / mask.ActualHeight; 563 | 564 | double transWidth = indicatorWidth - timeW; 565 | double transHeight = indicatorHeight - timeH; 566 | 567 | percentX = Math.Abs(percentX - transWidth / 2); 568 | percentY = Math.Abs(percentY - transHeight / 2); 569 | 570 | w = indicatorWidth * mask.ActualWidth; 571 | h = mask.ActualHeight * indicatorHeight; 572 | 573 | SetImageByScale(); 574 | 575 | // Message:更改区域位置 576 | Rect rectMark = new Rect(percentX * this.mask.ActualWidth, percentY * this.mask.ActualHeight, w, h); 577 | 578 | this.mask.UpdateSelectionRegion(rectMark, true); 579 | 580 | } 581 | 582 | private void SetImageByScale() 583 | { 584 | this.GetOffSetRate(); 585 | 586 | if (this.imgWidth < 0 || this.imgHeight < 0) return; 587 | 588 | this.vb.Width = this.Scale * this.imgWidth; 589 | this.vb.Height = this.Scale * this.imgHeight; 590 | 591 | this.SetOffSetByRate(); 592 | 593 | this.RefreshMarkVisible(); 594 | } 595 | } 596 | 597 | 598 | //将所有命令封装在一个类里面 599 | 600 | public class ImageBaseCommands 601 | { 602 | public static RoutedUICommand DefaultCommand = new RoutedUICommand(); 603 | } 604 | 605 | 606 | } 607 | -------------------------------------------------------------------------------- /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/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/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/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/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 | -------------------------------------------------------------------------------- /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/UserControl/HeBianGu.Control.ImagePlayer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Source/UserControl/HeBianGu.Control.ImagePlayer/Themes/Default.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/UserControl/HeBianGu.Control.ImagePlayer/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Source/UserControl/HeBianGu.Control.ImagePlayer/View/ImagePlayer.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /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 ConvertToImageSource 121 | { 122 | get { return (Func)GetValue(ConvertToImageSourceProperty); } 123 | set { SetValue(ConvertToImageSourceProperty, value); } 124 | } 125 | 126 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 127 | public static readonly DependencyProperty ConvertToImageSourceProperty = 128 | DependencyProperty.Register("ConvertToImageSource", typeof(Func), typeof(ImagePlayer), new PropertyMetadata(new Func(l => l as ImageSource), (d, e) => 129 | { 130 | ImagePlayer control = d as ImagePlayer; 131 | 132 | if (control == null) return; 133 | 134 | Func config = e.NewValue as Func; 135 | 136 | })); 137 | 138 | 139 | 140 | public int Index 141 | { 142 | get { return (int)GetValue(IndexProperty); } 143 | set { SetValue(IndexProperty, value); } 144 | } 145 | 146 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 147 | public static readonly DependencyProperty IndexProperty = 148 | DependencyProperty.Register("Index", typeof(int), typeof(ImagePlayer), new PropertyMetadata(default(int), (d, e) => 149 | { 150 | ImagePlayer control = d as ImagePlayer; 151 | 152 | if (control == null) return; 153 | 154 | //int config = e.NewValue as int; 155 | 156 | })); 157 | 158 | 159 | public LinkedListNode Current 160 | { 161 | get { return (LinkedListNode)GetValue(CurrentProperty); } 162 | set { SetValue(CurrentProperty, value); } 163 | } 164 | 165 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 166 | public static readonly DependencyProperty CurrentProperty = 167 | DependencyProperty.Register("Current", typeof(LinkedListNode), typeof(ImagePlayer), new PropertyMetadata(default(LinkedListNode), (d, e) => 168 | { 169 | ImagePlayer control = d as ImagePlayer; 170 | 171 | if (control == null) return; 172 | 173 | LinkedListNode config = e.NewValue as LinkedListNode; 174 | 175 | if (config == null) return; 176 | 177 | control.SelectedItem = config.Value; 178 | 179 | if (control._core == null) return; 180 | 181 | control._core.ImageSource = control.ConvertToImageSource.Invoke(config.Value); 182 | 183 | 184 | })); 185 | 186 | 187 | 188 | public object SelectedItem 189 | { 190 | get { return (object)GetValue(SelectedItemProperty); } 191 | set { SetValue(SelectedItemProperty, value); } 192 | } 193 | 194 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 195 | public static readonly DependencyProperty SelectedItemProperty = 196 | DependencyProperty.Register("SelectedItem", typeof(object), typeof(ImagePlayer), new PropertyMetadata(default(object), (d, e) => 197 | { 198 | ImagePlayer control = d as ImagePlayer; 199 | 200 | if (control == null) return; 201 | 202 | object config = e.NewValue as object; 203 | 204 | })); 205 | 206 | 207 | public IEnumerable DataSource 208 | { 209 | get { return (IEnumerable)GetValue(DataSourceProperty); } 210 | set { SetValue(DataSourceProperty, value); } 211 | } 212 | 213 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 214 | public static readonly DependencyProperty DataSourceProperty = 215 | DependencyProperty.Register("DataSource", typeof(IEnumerable), typeof(ImagePlayer), new PropertyMetadata(default(IEnumerable), (d, e) => 216 | { 217 | ImagePlayer control = d as ImagePlayer; 218 | 219 | if (control == null) return; 220 | 221 | if (e.OldValue is INotifyCollectionChanged notify) 222 | { 223 | if (notify != null) 224 | { 225 | notify.CollectionChanged -= control.CollectionChanged; 226 | } 227 | } 228 | 229 | if (e.NewValue is INotifyCollectionChanged notify1) 230 | { 231 | if (notify1 != null) 232 | { 233 | notify1.CollectionChanged += control.CollectionChanged; 234 | } 235 | } 236 | 237 | control.RefreshData(e.NewValue as IEnumerable); 238 | })); 239 | 240 | private void CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 241 | { 242 | IEnumerable config = sender as IEnumerable; 243 | 244 | this.RefreshData(config); 245 | 246 | } 247 | 248 | void RefreshData(IEnumerable source) 249 | { 250 | this._cache.Clear(); 251 | 252 | if (source == null) return; 253 | 254 | foreach (var item in source) 255 | { 256 | _cache.AddLast(item); 257 | 258 | } 259 | this.Current = this.Current = _cache.First; 260 | 261 | this.Index = 1; 262 | } 263 | 264 | LinkedList _cache = new LinkedList(); 265 | 266 | //声明和注册路由事件 267 | public static readonly RoutedEvent NotifyMessagedRoutedEvent = 268 | EventManager.RegisterRoutedEvent("NotifyMessaged", RoutingStrategy.Bubble, typeof(EventHandler), typeof(ImagePlayer)); 269 | //CLR事件包装 270 | public event RoutedEventHandler NotifyMessaged 271 | { 272 | add { this.AddHandler(NotifyMessagedRoutedEvent, value); } 273 | remove { this.RemoveHandler(NotifyMessagedRoutedEvent, value); } 274 | } 275 | 276 | //激发路由事件,借用Click事件的激发方法 277 | 278 | protected void OnNotifyMessaged(string message) 279 | { 280 | this.Message = message; 281 | 282 | RoutedEventArgs args = new RoutedEventArgs(NotifyMessagedRoutedEvent, this); 283 | this.RaiseEvent(args); 284 | } 285 | 286 | public string Message 287 | { 288 | get { return (string)GetValue(MessageProperty); } 289 | set { SetValue(MessageProperty, value); } 290 | } 291 | 292 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 293 | public static readonly DependencyProperty MessageProperty = 294 | DependencyProperty.Register("Message", typeof(string), typeof(ImagePlayer), new PropertyMetadata(default(string), (d, e) => 295 | { 296 | ImagePlayer control = d as ImagePlayer; 297 | 298 | if (control == null) return; 299 | 300 | string config = e.NewValue as string; 301 | 302 | })); 303 | 304 | 305 | public string CoreMessage 306 | { 307 | get { return (string)GetValue(CoreMessageProperty); } 308 | set { SetValue(CoreMessageProperty, value); } 309 | } 310 | 311 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 312 | public static readonly DependencyProperty CoreMessageProperty = 313 | DependencyProperty.Register("CoreMessage", typeof(string), typeof(ImagePlayer), new PropertyMetadata(default(string), (d, e) => 314 | { 315 | ImagePlayer control = d as ImagePlayer; 316 | 317 | if (control == null) return; 318 | 319 | string config = e.NewValue as string; 320 | 321 | })); 322 | 323 | 324 | //声明和注册路由事件 325 | public static readonly RoutedEvent CoreMessagedRoutedEvent = 326 | EventManager.RegisterRoutedEvent("CoreMessaged", RoutingStrategy.Bubble, typeof(EventHandler), typeof(ImagePlayer)); 327 | //CLR事件包装 328 | public event RoutedEventHandler CoreMessaged 329 | { 330 | add { this.AddHandler(CoreMessagedRoutedEvent, value); } 331 | remove { this.RemoveHandler(CoreMessagedRoutedEvent, value); } 332 | } 333 | 334 | //激发路由事件,借用Click事件的激发方法 335 | 336 | protected void OnCoreMessaged(string message) 337 | { 338 | this.CoreMessage = message; 339 | 340 | RoutedEventArgs args = new RoutedEventArgs(CoreMessagedRoutedEvent, this); 341 | this.RaiseEvent(args); 342 | } 343 | 344 | 345 | public OperateType OperateType 346 | { 347 | get { return (OperateType)GetValue(OperateTypeProperty); } 348 | set { SetValue(OperateTypeProperty, value); } 349 | } 350 | 351 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 352 | public static readonly DependencyProperty OperateTypeProperty = 353 | DependencyProperty.Register("OperateType", typeof(OperateType), typeof(ImagePlayer), new PropertyMetadata(default(OperateType), (d, e) => 354 | { 355 | ImagePlayer control = d as ImagePlayer; 356 | 357 | if (control == null) return; 358 | 359 | //OperateType config = e.NewValue as OperateType; 360 | 361 | })); 362 | 363 | 364 | public object ToolContent 365 | { 366 | get { return (object)GetValue(ToolContentProperty); } 367 | set { SetValue(ToolContentProperty, value); } 368 | } 369 | 370 | // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... 371 | public static readonly DependencyProperty ToolContentProperty = 372 | DependencyProperty.Register("ToolContent", typeof(object), typeof(ImagePlayer), new PropertyMetadata(default(object), (d, e) => 373 | { 374 | ImagePlayer control = d as ImagePlayer; 375 | 376 | if (control == null) return; 377 | 378 | object config = e.NewValue as object; 379 | 380 | })); 381 | 382 | 383 | } 384 | } 385 | -------------------------------------------------------------------------------- /Source/UserControl/HeBianGu.Control.ImagePlayer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | --------------------------------------------------------------------------------