├── .editorconfig ├── .gitignore ├── Assets ├── app-icon-black.xcf └── app-icon.xcf ├── LICENSE ├── Project ├── Demo │ ├── AboutBox.Designer.cs │ ├── AboutBox.cs │ ├── AboutBox.resx │ ├── App.config │ ├── FormMain.Designer.cs │ ├── FormMain.cs │ ├── FormMain.resx │ ├── MonitorConfigDemo.csproj │ ├── Program.cs │ ├── Properties │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ ├── Settings.settings │ │ └── launchSettings.json │ ├── Resources │ │ ├── AboutImage.png │ │ └── AppIcon.ico │ ├── RichTextBoxEx.cs │ └── packages.config ├── Lib │ ├── ColorTemperature.h │ ├── Monitors.cpp │ ├── Monitors.h │ ├── PhysicalMonitor.cpp │ ├── PhysicalMonitor.h │ ├── Setting.cpp │ ├── Setting.h │ ├── SharpLibMonitorConfig.vcxproj │ ├── SharpLibMonitorConfig.vcxproj.filters │ ├── SharpLibMonitorConfig.vcxproj.user │ ├── VirtualMonitor.cpp │ ├── VirtualMonitor.h │ └── resource.h └── SharpLibMonitorConfig.sln ├── Publish ├── MonitorConfigDemo.nuspec └── SharpLibMonitorConfig.nuspec └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # Rules in this file were initially inferred by Visual Studio IntelliCode from the Template Studio codebase. 2 | # You can modify the rules from these initially generated values to suit your own policies. 3 | # You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference. 4 | 5 | [*.cs] 6 | 7 | #Core editorconfig formatting - indentation 8 | 9 | #use soft tabs (spaces) for indentation 10 | indent_style = space 11 | 12 | #Formatting - new line options 13 | 14 | #place else statements on a new line 15 | csharp_new_line_before_else = true 16 | #require braces to be on a new line for lambdas, methods, control_blocks, types, properties, and accessors (also known as "Allman" style) 17 | csharp_new_line_before_open_brace = all 18 | 19 | #Formatting - organize using options 20 | 21 | #sort System.* using directives alphabetically, and place them before other usings 22 | dotnet_sort_system_directives_first = true 23 | 24 | #Formatting - spacing options 25 | 26 | #require NO space between a cast and the value 27 | csharp_space_after_cast = false 28 | #require a space before the colon for bases or interfaces in a type declaration 29 | csharp_space_after_colon_in_inheritance_clause = true 30 | #require a space after a keyword in a control flow statement such as a for loop 31 | csharp_space_after_keywords_in_control_flow_statements = true 32 | #require a space before the colon for bases or interfaces in a type declaration 33 | csharp_space_before_colon_in_inheritance_clause = true 34 | #remove space within empty argument list parentheses 35 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 36 | #remove space between method call name and opening parenthesis 37 | csharp_space_between_method_call_name_and_opening_parenthesis = false 38 | #do not place space characters after the opening parenthesis and before the closing parenthesis of a method call 39 | csharp_space_between_method_call_parameter_list_parentheses = false 40 | #remove space within empty parameter list parentheses for a method declaration 41 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 42 | #place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. 43 | csharp_space_between_method_declaration_parameter_list_parentheses = false 44 | 45 | #Formatting - wrapping options 46 | 47 | #leave code block on separate lines 48 | csharp_preserve_single_line_blocks = false 49 | 50 | #Style - Code block preferences 51 | 52 | #prefer curly braces even for one line of code 53 | csharp_prefer_braces = true:suggestion 54 | 55 | #Style - expression bodied member options 56 | 57 | #prefer expression bodies for accessors 58 | csharp_style_expression_bodied_accessors = true:warning 59 | #prefer block bodies for constructors 60 | csharp_style_expression_bodied_constructors = false:suggestion 61 | #prefer expression bodies for methods 62 | csharp_style_expression_bodied_methods = when_on_single_line:silent 63 | #prefer expression-bodied members for properties 64 | csharp_style_expression_bodied_properties = true:warning 65 | 66 | #Style - expression level options 67 | 68 | #prefer out variables to be declared before the method call 69 | csharp_style_inlined_variable_declaration = false:suggestion 70 | #prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them 71 | dotnet_style_predefined_type_for_member_access = true:suggestion 72 | 73 | #Style - Expression-level preferences 74 | 75 | #prefer default over default(T) 76 | csharp_prefer_simple_default_expression = true:suggestion 77 | #prefer objects to be initialized using object initializers when possible 78 | dotnet_style_object_initializer = true:suggestion 79 | 80 | #Style - implicit and explicit types 81 | 82 | #prefer var over explicit type in all cases, unless overridden by another code style rule 83 | csharp_style_var_elsewhere = true:suggestion 84 | #prefer var is used to declare variables with built-in system types such as int 85 | csharp_style_var_for_built_in_types = true:suggestion 86 | #prefer var when the type is already mentioned on the right-hand side of a declaration expression 87 | csharp_style_var_when_type_is_apparent = true:suggestion 88 | 89 | #Style - language keyword and framework type options 90 | 91 | #prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them 92 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 93 | 94 | #Style - Language rules 95 | csharp_style_implicit_object_creation_when_type_is_apparent = true:warning 96 | csharp_style_var_for_built_in_types = true:warning 97 | 98 | #Style - modifier options 99 | 100 | #prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods. 101 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion 102 | 103 | #Style - Modifier preferences 104 | 105 | #when this rule is set to a list of modifiers, prefer the specified ordering. 106 | csharp_preferred_modifier_order = public,private,protected,internal,static,async,readonly,override,sealed,abstract,virtual:warning 107 | dotnet_style_readonly_field = true:warning 108 | 109 | #Style - Pattern matching 110 | 111 | #prefer pattern matching instead of is expression with type casts 112 | csharp_style_pattern_matching_over_as_with_null_check = true:warning 113 | 114 | #Style - qualification options 115 | 116 | #prefer events not to be prefaced with this. or Me. in Visual Basic 117 | dotnet_style_qualification_for_event = false:suggestion 118 | #prefer fields not to be prefaced with this. or Me. in Visual Basic 119 | dotnet_style_qualification_for_field = false:suggestion 120 | #prefer methods not to be prefaced with this. or Me. in Visual Basic 121 | dotnet_style_qualification_for_method = false:suggestion 122 | #prefer properties not to be prefaced with this. or Me. in Visual Basic 123 | dotnet_style_qualification_for_property = false:suggestion 124 | csharp_indent_labels = one_less_than_current 125 | csharp_using_directive_placement = outside_namespace:silent 126 | csharp_prefer_simple_using_statement = true:warning 127 | csharp_style_namespace_declarations = file_scoped:warning 128 | csharp_style_expression_bodied_operators = false:silent 129 | csharp_style_expression_bodied_indexers = true:silent 130 | csharp_style_expression_bodied_lambdas = true:silent 131 | csharp_style_expression_bodied_local_functions = false:silent 132 | 133 | [*.{cs,vb}] 134 | dotnet_style_operator_placement_when_wrapping = beginning_of_line 135 | tab_width = 4 136 | indent_size = 4 137 | end_of_line = crlf 138 | dotnet_style_coalesce_expression = true:suggestion 139 | dotnet_style_null_propagation = true:suggestion 140 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion 141 | dotnet_style_prefer_auto_properties = true:silent 142 | dotnet_style_object_initializer = true:suggestion 143 | dotnet_style_collection_initializer = true:suggestion 144 | dotnet_style_prefer_simplified_boolean_expressions = true:suggestion 145 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent 146 | dotnet_style_prefer_conditional_expression_over_return = true:silent 147 | [*.{cs,vb}] 148 | 149 | #Style - Unnecessary code rules 150 | csharp_style_unused_value_assignment_preference = discard_variable:warning 151 | 152 | #### Naming styles #### 153 | 154 | # Naming rules 155 | 156 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion 157 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface 158 | dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i 159 | 160 | dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion 161 | dotnet_naming_rule.types_should_be_pascal_case.symbols = types 162 | dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case 163 | 164 | dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion 165 | dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members 166 | dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case 167 | 168 | # Symbol specifications 169 | 170 | dotnet_naming_symbols.interface.applicable_kinds = interface 171 | dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 172 | dotnet_naming_symbols.interface.required_modifiers = 173 | 174 | dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum 175 | dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 176 | dotnet_naming_symbols.types.required_modifiers = 177 | 178 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method 179 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected 180 | dotnet_naming_symbols.non_field_members.required_modifiers = 181 | 182 | # Naming styles 183 | 184 | dotnet_naming_style.begins_with_i.required_prefix = I 185 | dotnet_naming_style.begins_with_i.required_suffix = 186 | dotnet_naming_style.begins_with_i.word_separator = 187 | dotnet_naming_style.begins_with_i.capitalization = pascal_case 188 | 189 | dotnet_naming_style.pascal_case.required_prefix = 190 | dotnet_naming_style.pascal_case.required_suffix = 191 | dotnet_naming_style.pascal_case.word_separator = 192 | dotnet_naming_style.pascal_case.capitalization = pascal_case 193 | 194 | dotnet_naming_style.pascal_case.required_prefix = 195 | dotnet_naming_style.pascal_case.required_suffix = 196 | dotnet_naming_style.pascal_case.word_separator = 197 | dotnet_naming_style.pascal_case.capitalization = pascal_case 198 | dotnet_style_explicit_tuple_names = true:suggestion 199 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 200 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 201 | dotnet_style_prefer_compound_assignment = true:warning 202 | dotnet_style_prefer_simplified_interpolation = true:suggestion 203 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | # but not Directory.Build.rsp, as it configures directory-level build defaults 86 | !Directory.Build.rsp 87 | *.sbr 88 | *.tlb 89 | *.tli 90 | *.tlh 91 | *.tmp 92 | *.tmp_proj 93 | *_wpftmp.csproj 94 | *.log 95 | *.tlog 96 | *.vspscc 97 | *.vssscc 98 | .builds 99 | *.pidb 100 | *.svclog 101 | *.scc 102 | 103 | # Chutzpah Test files 104 | _Chutzpah* 105 | 106 | # Visual C++ cache files 107 | ipch/ 108 | *.aps 109 | *.ncb 110 | *.opendb 111 | *.opensdf 112 | *.sdf 113 | *.cachefile 114 | *.VC.db 115 | *.VC.VC.opendb 116 | 117 | # Visual Studio profiler 118 | *.psess 119 | *.vsp 120 | *.vspx 121 | *.sap 122 | 123 | # Visual Studio Trace Files 124 | *.e2e 125 | 126 | # TFS 2012 Local Workspace 127 | $tf/ 128 | 129 | # Guidance Automation Toolkit 130 | *.gpState 131 | 132 | # ReSharper is a .NET coding add-in 133 | _ReSharper*/ 134 | *.[Rr]e[Ss]harper 135 | *.DotSettings.user 136 | 137 | # TeamCity is a build add-in 138 | _TeamCity* 139 | 140 | # DotCover is a Code Coverage Tool 141 | *.dotCover 142 | 143 | # AxoCover is a Code Coverage Tool 144 | .axoCover/* 145 | !.axoCover/settings.json 146 | 147 | # Coverlet is a free, cross platform Code Coverage Tool 148 | coverage*.json 149 | coverage*.xml 150 | coverage*.info 151 | 152 | # Visual Studio code coverage results 153 | *.coverage 154 | *.coveragexml 155 | 156 | # NCrunch 157 | _NCrunch_* 158 | .*crunch*.local.xml 159 | nCrunchTemp_* 160 | 161 | # MightyMoose 162 | *.mm.* 163 | AutoTest.Net/ 164 | 165 | # Web workbench (sass) 166 | .sass-cache/ 167 | 168 | # Installshield output folder 169 | [Ee]xpress/ 170 | 171 | # DocProject is a documentation generator add-in 172 | DocProject/buildhelp/ 173 | DocProject/Help/*.HxT 174 | DocProject/Help/*.HxC 175 | DocProject/Help/*.hhc 176 | DocProject/Help/*.hhk 177 | DocProject/Help/*.hhp 178 | DocProject/Help/Html2 179 | DocProject/Help/html 180 | 181 | # Click-Once directory 182 | publish/ 183 | 184 | # Publish Web Output 185 | *.[Pp]ublish.xml 186 | *.azurePubxml 187 | # Note: Comment the next line if you want to checkin your web deploy settings, 188 | # but database connection strings (with potential passwords) will be unencrypted 189 | *.pubxml 190 | *.publishproj 191 | 192 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 193 | # checkin your Azure Web App publish settings, but sensitive information contained 194 | # in these scripts will be unencrypted 195 | PublishScripts/ 196 | 197 | # NuGet Packages 198 | *.nupkg 199 | # NuGet Symbol Packages 200 | *.snupkg 201 | # The packages folder can be ignored because of Package Restore 202 | **/[Pp]ackages/* 203 | # except build/, which is used as an MSBuild target. 204 | !**/[Pp]ackages/build/ 205 | # Uncomment if necessary however generally it will be regenerated when needed 206 | #!**/[Pp]ackages/repositories.config 207 | # NuGet v3's project.json files produces more ignorable files 208 | *.nuget.props 209 | *.nuget.targets 210 | 211 | # Microsoft Azure Build Output 212 | csx/ 213 | *.build.csdef 214 | 215 | # Microsoft Azure Emulator 216 | ecf/ 217 | rcf/ 218 | 219 | # Windows Store app package directories and files 220 | AppPackages/ 221 | BundleArtifacts/ 222 | Package.StoreAssociation.xml 223 | _pkginfo.txt 224 | *.appx 225 | *.appxbundle 226 | *.appxupload 227 | 228 | # Visual Studio cache files 229 | # files ending in .cache can be ignored 230 | *.[Cc]ache 231 | # but keep track of directories ending in .cache 232 | !?*.[Cc]ache/ 233 | 234 | # Others 235 | ClientBin/ 236 | ~$* 237 | *~ 238 | *.dbmdl 239 | *.dbproj.schemaview 240 | *.jfm 241 | *.pfx 242 | *.publishsettings 243 | orleans.codegen.cs 244 | 245 | # Including strong name files can present a security risk 246 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 247 | #*.snk 248 | 249 | # Since there are multiple workflows, uncomment next line to ignore bower_components 250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 251 | #bower_components/ 252 | 253 | # RIA/Silverlight projects 254 | Generated_Code/ 255 | 256 | # Backup & report files from converting an old project file 257 | # to a newer Visual Studio version. Backup files are not needed, 258 | # because we have git ;-) 259 | _UpgradeReport_Files/ 260 | Backup*/ 261 | UpgradeLog*.XML 262 | UpgradeLog*.htm 263 | ServiceFabricBackup/ 264 | *.rptproj.bak 265 | 266 | # SQL Server files 267 | *.mdf 268 | *.ldf 269 | *.ndf 270 | 271 | # Business Intelligence projects 272 | *.rdl.data 273 | *.bim.layout 274 | *.bim_*.settings 275 | *.rptproj.rsuser 276 | *- [Bb]ackup.rdl 277 | *- [Bb]ackup ([0-9]).rdl 278 | *- [Bb]ackup ([0-9][0-9]).rdl 279 | 280 | # Microsoft Fakes 281 | FakesAssemblies/ 282 | 283 | # GhostDoc plugin setting file 284 | *.GhostDoc.xml 285 | 286 | # Node.js Tools for Visual Studio 287 | .ntvs_analysis.dat 288 | node_modules/ 289 | 290 | # Visual Studio 6 build log 291 | *.plg 292 | 293 | # Visual Studio 6 workspace options file 294 | *.opt 295 | 296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 297 | *.vbw 298 | 299 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 300 | *.vbp 301 | 302 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 303 | *.dsw 304 | *.dsp 305 | 306 | # Visual Studio 6 technical files 307 | *.ncb 308 | *.aps 309 | 310 | # Visual Studio LightSwitch build output 311 | **/*.HTMLClient/GeneratedArtifacts 312 | **/*.DesktopClient/GeneratedArtifacts 313 | **/*.DesktopClient/ModelManifest.xml 314 | **/*.Server/GeneratedArtifacts 315 | **/*.Server/ModelManifest.xml 316 | _Pvt_Extensions 317 | 318 | # Paket dependency manager 319 | .paket/paket.exe 320 | paket-files/ 321 | 322 | # FAKE - F# Make 323 | .fake/ 324 | 325 | # CodeRush personal settings 326 | .cr/personal 327 | 328 | # Python Tools for Visual Studio (PTVS) 329 | __pycache__/ 330 | *.pyc 331 | 332 | # Cake - Uncomment if you are using it 333 | # tools/** 334 | # !tools/packages.config 335 | 336 | # Tabs Studio 337 | *.tss 338 | 339 | # Telerik's JustMock configuration file 340 | *.jmconfig 341 | 342 | # BizTalk build output 343 | *.btp.cs 344 | *.btm.cs 345 | *.odx.cs 346 | *.xsd.cs 347 | 348 | # OpenCover UI analysis results 349 | OpenCover/ 350 | 351 | # Azure Stream Analytics local run output 352 | ASALocalRun/ 353 | 354 | # MSBuild Binary and Structured Log 355 | *.binlog 356 | 357 | # NVidia Nsight GPU debugger configuration file 358 | *.nvuser 359 | 360 | # MFractors (Xamarin productivity tool) working folder 361 | .mfractor/ 362 | 363 | # Local History for Visual Studio 364 | .localhistory/ 365 | 366 | # Visual Studio History (VSHistory) files 367 | .vshistory/ 368 | 369 | # BeatPulse healthcheck temp database 370 | healthchecksdb 371 | 372 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 373 | MigrationBackup/ 374 | 375 | # Ionide (cross platform F# VS Code tools) working folder 376 | .ionide/ 377 | 378 | # Fody - auto-generated XML schema 379 | FodyWeavers.xsd 380 | 381 | # VS Code files for those working on multiple tools 382 | .vscode/* 383 | !.vscode/settings.json 384 | !.vscode/tasks.json 385 | !.vscode/launch.json 386 | !.vscode/extensions.json 387 | *.code-workspace 388 | 389 | # Local History for Visual Studio Code 390 | .history/ 391 | 392 | # Windows Installer files from build outputs 393 | *.cab 394 | *.msi 395 | *.msix 396 | *.msm 397 | *.msp 398 | 399 | # JetBrains Rider 400 | *.sln.iml 401 | -------------------------------------------------------------------------------- /Assets/app-icon-black.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slion/SharpLibMonitorConfig/2a37e6f23bfb3f10df4908529c1f73c5084e3aab/Assets/app-icon-black.xcf -------------------------------------------------------------------------------- /Assets/app-icon.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slion/SharpLibMonitorConfig/2a37e6f23bfb3f10df4908529c1f73c5084e3aab/Assets/app-icon.xcf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Project/Demo/AboutBox.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MonitorConfigDemo 2 | { 3 | partial class AboutBox 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | protected override void Dispose(bool disposing) 14 | { 15 | if (disposing && (components != null)) 16 | { 17 | components.Dispose(); 18 | } 19 | base.Dispose(disposing); 20 | } 21 | 22 | #region Windows Form Designer generated code 23 | 24 | /// 25 | /// Required method for Designer support - do not modify 26 | /// the contents of this method with the code editor. 27 | /// 28 | private void InitializeComponent() 29 | { 30 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox)); 31 | this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 32 | this.logoPictureBox = new System.Windows.Forms.PictureBox(); 33 | this.labelProductName = new System.Windows.Forms.Label(); 34 | this.labelVersion = new System.Windows.Forms.Label(); 35 | this.labelCopyright = new System.Windows.Forms.Label(); 36 | this.labelCompanyName = new System.Windows.Forms.Label(); 37 | this.okButton = new System.Windows.Forms.Button(); 38 | this.textBoxDescription = new RichTextBoxLinks.RichTextBoxEx(); 39 | this.tableLayoutPanel.SuspendLayout(); 40 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); 41 | this.SuspendLayout(); 42 | // 43 | // tableLayoutPanel 44 | // 45 | this.tableLayoutPanel.ColumnCount = 2; 46 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33F)); 47 | this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67F)); 48 | this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0); 49 | this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0); 50 | this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1); 51 | this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2); 52 | this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3); 53 | this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5); 54 | this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4); 55 | this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 56 | this.tableLayoutPanel.Location = new System.Drawing.Point(9, 9); 57 | this.tableLayoutPanel.Name = "tableLayoutPanel"; 58 | this.tableLayoutPanel.RowCount = 6; 59 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.523809F)); 60 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.523809F)); 61 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.523809F)); 62 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.523809F)); 63 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 47.61905F)); 64 | this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F)); 65 | this.tableLayoutPanel.Size = new System.Drawing.Size(397, 181); 66 | this.tableLayoutPanel.TabIndex = 0; 67 | // 68 | // logoPictureBox 69 | // 70 | this.logoPictureBox.Dock = System.Windows.Forms.DockStyle.Fill; 71 | this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); 72 | this.logoPictureBox.InitialImage = null; 73 | this.logoPictureBox.Location = new System.Drawing.Point(3, 3); 74 | this.logoPictureBox.Name = "logoPictureBox"; 75 | this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6); 76 | this.logoPictureBox.Size = new System.Drawing.Size(125, 175); 77 | this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; 78 | this.logoPictureBox.TabIndex = 12; 79 | this.logoPictureBox.TabStop = false; 80 | // 81 | // labelProductName 82 | // 83 | this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill; 84 | this.labelProductName.Location = new System.Drawing.Point(137, 0); 85 | this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 86 | this.labelProductName.MaximumSize = new System.Drawing.Size(0, 17); 87 | this.labelProductName.Name = "labelProductName"; 88 | this.labelProductName.Size = new System.Drawing.Size(257, 17); 89 | this.labelProductName.TabIndex = 19; 90 | this.labelProductName.Text = "Product Name"; 91 | this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 92 | // 93 | // labelVersion 94 | // 95 | this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill; 96 | this.labelVersion.Location = new System.Drawing.Point(137, 17); 97 | this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 98 | this.labelVersion.MaximumSize = new System.Drawing.Size(0, 17); 99 | this.labelVersion.Name = "labelVersion"; 100 | this.labelVersion.Size = new System.Drawing.Size(257, 17); 101 | this.labelVersion.TabIndex = 0; 102 | this.labelVersion.Text = "Version"; 103 | this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 104 | // 105 | // labelCopyright 106 | // 107 | this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill; 108 | this.labelCopyright.Location = new System.Drawing.Point(137, 34); 109 | this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 110 | this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 17); 111 | this.labelCopyright.Name = "labelCopyright"; 112 | this.labelCopyright.Size = new System.Drawing.Size(257, 17); 113 | this.labelCopyright.TabIndex = 21; 114 | this.labelCopyright.Text = "Copyright"; 115 | this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 116 | // 117 | // labelCompanyName 118 | // 119 | this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill; 120 | this.labelCompanyName.Location = new System.Drawing.Point(137, 51); 121 | this.labelCompanyName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 122 | this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 17); 123 | this.labelCompanyName.Name = "labelCompanyName"; 124 | this.labelCompanyName.Size = new System.Drawing.Size(257, 17); 125 | this.labelCompanyName.TabIndex = 22; 126 | this.labelCompanyName.Text = "Company Name"; 127 | this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 128 | // 129 | // okButton 130 | // 131 | this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 132 | this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 133 | this.okButton.Location = new System.Drawing.Point(319, 157); 134 | this.okButton.Name = "okButton"; 135 | this.okButton.Size = new System.Drawing.Size(75, 21); 136 | this.okButton.TabIndex = 24; 137 | this.okButton.Text = "&OK"; 138 | // 139 | // textBoxDescription 140 | // 141 | this.textBoxDescription.BackColor = System.Drawing.SystemColors.Control; 142 | this.textBoxDescription.BorderStyle = System.Windows.Forms.BorderStyle.None; 143 | this.textBoxDescription.Location = new System.Drawing.Point(137, 68); 144 | this.textBoxDescription.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); 145 | this.textBoxDescription.Name = "textBoxDescription"; 146 | this.textBoxDescription.ReadOnly = true; 147 | this.textBoxDescription.Size = new System.Drawing.Size(257, 86); 148 | this.textBoxDescription.TabIndex = 25; 149 | this.textBoxDescription.Text = ""; 150 | this.textBoxDescription.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.textBoxDescription_LinkClicked); 151 | // 152 | // AboutBox 153 | // 154 | this.AcceptButton = this.okButton; 155 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 156 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 157 | this.ClientSize = new System.Drawing.Size(415, 199); 158 | this.Controls.Add(this.tableLayoutPanel); 159 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 160 | this.MaximizeBox = false; 161 | this.MinimizeBox = false; 162 | this.Name = "AboutBox"; 163 | this.Padding = new System.Windows.Forms.Padding(9); 164 | this.ShowIcon = false; 165 | this.ShowInTaskbar = false; 166 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 167 | this.Text = "AboutBox"; 168 | this.tableLayoutPanel.ResumeLayout(false); 169 | ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); 170 | this.ResumeLayout(false); 171 | 172 | } 173 | 174 | #endregion 175 | 176 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 177 | private System.Windows.Forms.PictureBox logoPictureBox; 178 | private System.Windows.Forms.Label labelProductName; 179 | private System.Windows.Forms.Label labelVersion; 180 | private System.Windows.Forms.Label labelCopyright; 181 | private System.Windows.Forms.Label labelCompanyName; 182 | private System.Windows.Forms.Button okButton; 183 | private RichTextBoxLinks.RichTextBoxEx textBoxDescription; 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /Project/Demo/AboutBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Windows.Forms; 9 | 10 | namespace MonitorConfigDemo 11 | { 12 | partial class AboutBox : Form 13 | { 14 | public AboutBox() 15 | { 16 | InitializeComponent(); 17 | this.Text = String.Format("About {0}", AssemblyProduct); 18 | this.labelProductName.Text = AssemblyProduct; 19 | //this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); 20 | this.labelVersion.Text = AssemblyVersion; 21 | this.labelCopyright.Text = AssemblyCopyright; 22 | this.labelCompanyName.Text = AssemblyCompany; 23 | //this.textBoxDescription.Text = AssemblyDescription; 24 | textBoxDescription.SelectedText = AssemblyDescription + "\n"; 25 | textBoxDescription.SelectedText = "Source code available on "; 26 | textBoxDescription.InsertLink("GitHub", "https://github.com/Slion/SharpLibMonitorConfig"); 27 | //textBoxDescription.SelectedText = ".\nFeel free to use our "; 28 | //textBoxDescription.InsertLink("NuGet package\n", "https://www.nuget.org/packages/SharpLibHid/"); 29 | textBoxDescription.SelectedText = ".\nInstaller available on "; 30 | textBoxDescription.InsertLink("Slions\n", "https://slions.net/resources/monitor-configuration-demo.3/"); 31 | textBoxDescription.SelectedText = ".\nUse at your own risks."; 32 | } 33 | 34 | #region Assembly Attribute Accessors 35 | 36 | public string AssemblyTitle 37 | { 38 | get 39 | { 40 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); 41 | if (attributes.Length > 0) 42 | { 43 | AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; 44 | if (titleAttribute.Title != "") 45 | { 46 | return titleAttribute.Title; 47 | } 48 | } 49 | return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); 50 | } 51 | } 52 | 53 | public string AssemblyVersion 54 | { 55 | get 56 | { 57 | return Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + 58 | "." + Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() + 59 | "." + Assembly.GetExecutingAssembly().GetName().Version.Build.ToString(); 60 | } 61 | } 62 | 63 | public string AssemblyDescription 64 | { 65 | get 66 | { 67 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); 68 | if (attributes.Length == 0) 69 | { 70 | return ""; 71 | } 72 | return ((AssemblyDescriptionAttribute)attributes[0]).Description; 73 | } 74 | } 75 | 76 | public string AssemblyProduct 77 | { 78 | get 79 | { 80 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); 81 | if (attributes.Length == 0) 82 | { 83 | return ""; 84 | } 85 | return ((AssemblyProductAttribute)attributes[0]).Product; 86 | } 87 | } 88 | 89 | public string AssemblyCopyright 90 | { 91 | get 92 | { 93 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); 94 | if (attributes.Length == 0) 95 | { 96 | return ""; 97 | } 98 | return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; 99 | } 100 | } 101 | 102 | public string AssemblyCompany 103 | { 104 | get 105 | { 106 | object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); 107 | if (attributes.Length == 0) 108 | { 109 | return ""; 110 | } 111 | return ((AssemblyCompanyAttribute)attributes[0]).Company; 112 | } 113 | } 114 | #endregion 115 | 116 | private void textBoxDescription_LinkClicked(object sender, LinkClickedEventArgs e) 117 | { 118 | string url = e.LinkText.Split('#')[1]; 119 | ProcessStartInfo sInfo = new ProcessStartInfo(url); 120 | Process.Start(sInfo); 121 | } 122 | 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /Project/Demo/AboutBox.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 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | 123 | iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL 124 | EwAACxMBAJqcGAAAAAd0SU1FB+EEHg0qNvyDLgkAAAa/SURBVHhe7dxBi1bnGQZgJfnGhBBaxmrSZNrx 125 | s466EIqCixa3FsEm7ly2LlLIDyj6A/wJ7dZVWzSuEihCN90mi6SFEVpwI/6AhEAW7c4+j3xJTp7vFDq8 126 | 1Zn3nOuCe3MmWZw+97kNIdNDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 127 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAdzx9+nQj8kbkx9J18oYbq7PCfxdFORz5fuR8 128 | 5EbkfZlE8pZ507zt4dW54VtRjEVkO/LTyHuRsSJJv/lNJG+bN16szg7PPv6XIycjpyO/jIwVSPpP3jZv 129 | nLd+eXV+5i7K8KNVMTLXI2Plkf6Tt/36zlur8zNnUYTXBqV4NgC7u7s3L168+LcjR478O/8S6Tdxw3/F 130 | LT/Lm+Zty61fi7+GOYsS/HBYisePH/96c3Pz8/yRTCdHjx79/MmTJ78a3jryZvyMOYsSLIeluHLlykf5 131 | WKaXuO2Hw1tHlvGcOYsS7AxLcerUqYf5WKaXnZ2dh8NbR3biOXNWCnF6uVz+Mx/L9JK3rfeO58xZLYQB 132 | mG4MAGtqIQzAdGMAWFMLsZcB2N7e/vv58+d/J/uXvMHYbcZiAFhTC7GXAbh8+fIf6t8vLzZ5g7HbjMUA 133 | sKYWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSp 134 | hTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEM 135 | QF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BX 136 | DABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNA 137 | k1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQW 138 | wgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAA 139 | fcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8x 140 | ADSphTAAfcUA0KQWwgD0FQNAk1oIA9BXDABNaiEMQF8xADSphTAAfcUA0KQWwgD0FQNAk1qIvQzA1atX 141 | P4i/55LsX/IGY7cZiwFgTS3EXgbg+vXrf46/533Zv+QNxm4zFgPAmloIA9BXDABNaiEMQF8xADSphdjL 142 | AFy7du0vjx49+q3sX/IGY7cZiwFgTS3EXgZA+ooBYE0thAGYbgwAa2ohDMB0YwBYUwtx4sSJf+RjmV7y 143 | tvXe8Zw5q4XY2trazccyveRt673jOXNWC3Hs2LFP87FML3nbeu94zpzVQhiA6cYAsCZKsDMsxPHjxz/J 144 | xzK9xG0/Ht46shPPmbMowclhKc6cOfOnfCzTy9mzZ/84vHXkZDxnzqIEbw1Lcffu3Z9vbGx8kT+S6WSx 145 | WHx5586d/A3C4QC8FT9jzqIEr5dSnL558+a7m5ubD/PH0n/ilru3bt16p9458nr8nLmLImyXYjzL/fv3 146 | f3b79u1f7Efu3bv33oMHD25NIfkuY+/4IpI3HLttZHt1fuYuyrAROTUox0FI/ok1+htwHWbsT9/9TN56 147 | Y3V+eDYCr0S+8y8E9zkG4Pkkb/zK6uzwrSjGS5FjkYPwTwMG4P+bn0Tyti+tzg3joiSHI69G8l8Qfu8F 148 | JQv6TWFv3Ljx+0uXLn0yheS7DN8tku869r/B80jeMG95eHVeOHiioMvINx/JhQsX/pqPp5B8l+G7RZbx 149 | HPhafhTDj8QAwIzkRzH8SAwAzEh+FMOP5Ny5c//z/9fdQU++y/DdIgYAhvKjGH4ky+Xyw3w8heS7DN8t 150 | YgBgKD+K4UdiAGBG8qMYfiQGAGYkP4rhRxLuLRaLr6aQfJfhu0UMAAzFRzH6C0kTjV/EgaH4KPI/Ux37 151 | WKaYH6xeG0jxUeTvIRykX0Z6Xsl39N/jQxUfxiKytfpQppi3I4vV6wJj4iPJfxo4EslfUZ5C8l38qQ8A 152 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 153 | AAAAAAAAAAAAAAAAAAD77tCh/wCMbZCwCZPyhwAAAABJRU5ErkJggg== 154 | 155 | 156 | -------------------------------------------------------------------------------- /Project/Demo/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Project/Demo/FormMain.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MonitorConfigDemo 2 | { 3 | partial class FormMain 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain)); 33 | this.iComboBoxVirtualMonitors = new System.Windows.Forms.ComboBox(); 34 | this.iButtonRefresh = new System.Windows.Forms.Button(); 35 | this.iLabelVirtualMonitors = new System.Windows.Forms.Label(); 36 | this.iComboBoxPhysicalMonitors = new System.Windows.Forms.ComboBox(); 37 | this.iLabelPhysicalMonitors = new System.Windows.Forms.Label(); 38 | this.iLabelBrightness = new System.Windows.Forms.Label(); 39 | this.iTrackBarBrightness = new System.Windows.Forms.TrackBar(); 40 | this.iToolTip = new System.Windows.Forms.ToolTip(this.components); 41 | this.iLabelBrightnessPercent = new System.Windows.Forms.Label(); 42 | this.iLabelContrastPercent = new System.Windows.Forms.Label(); 43 | this.iTrackBarContrast = new System.Windows.Forms.TrackBar(); 44 | this.iLabelContrast = new System.Windows.Forms.Label(); 45 | this.iButtonColorReset = new System.Windows.Forms.Button(); 46 | this.iButtonFactoryReset = new System.Windows.Forms.Button(); 47 | this.iLabelMonitorTech = new System.Windows.Forms.Label(); 48 | this.iGroupBoxGain = new System.Windows.Forms.GroupBox(); 49 | this.iLabelGainBluePercent = new System.Windows.Forms.Label(); 50 | this.iLabelGainGreenPercent = new System.Windows.Forms.Label(); 51 | this.iLabelGainRedPercent = new System.Windows.Forms.Label(); 52 | this.iTrackBarGainBlue = new System.Windows.Forms.TrackBar(); 53 | this.iLabelGainBlue = new System.Windows.Forms.Label(); 54 | this.iTrackBarGainGreen = new System.Windows.Forms.TrackBar(); 55 | this.iLabelGainGreen = new System.Windows.Forms.Label(); 56 | this.iTrackBarGainRed = new System.Windows.Forms.TrackBar(); 57 | this.iLabelGainRed = new System.Windows.Forms.Label(); 58 | this.iLabelColorTemperature = new System.Windows.Forms.Label(); 59 | this.iComboBoxColorTemperature = new System.Windows.Forms.ComboBox(); 60 | this.iCheckBoxColorTemperatureUnlock = new System.Windows.Forms.CheckBox(); 61 | this.iLabelDeviceName = new System.Windows.Forms.Label(); 62 | this.iGroupBoxDrive = new System.Windows.Forms.GroupBox(); 63 | this.iLabelDriveBluePercent = new System.Windows.Forms.Label(); 64 | this.iLabelDriveGreenPercent = new System.Windows.Forms.Label(); 65 | this.iLabelDriveRedPercent = new System.Windows.Forms.Label(); 66 | this.iTrackBarDriveBlue = new System.Windows.Forms.TrackBar(); 67 | this.iLabelDriveBlue = new System.Windows.Forms.Label(); 68 | this.iTrackBarDriveGreen = new System.Windows.Forms.TrackBar(); 69 | this.iLabelDriveGreen = new System.Windows.Forms.Label(); 70 | this.iTrackBarDriveRed = new System.Windows.Forms.TrackBar(); 71 | this.iLabelDriveRed = new System.Windows.Forms.Label(); 72 | this.iMenuStrip = new System.Windows.Forms.MenuStrip(); 73 | this.iToolStripMenuItemUpdate = new System.Windows.Forms.ToolStripMenuItem(); 74 | this.iToolStripMenuItemAbout = new System.Windows.Forms.ToolStripMenuItem(); 75 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarBrightness)).BeginInit(); 76 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarContrast)).BeginInit(); 77 | this.iGroupBoxGain.SuspendLayout(); 78 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarGainBlue)).BeginInit(); 79 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarGainGreen)).BeginInit(); 80 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarGainRed)).BeginInit(); 81 | this.iGroupBoxDrive.SuspendLayout(); 82 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarDriveBlue)).BeginInit(); 83 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarDriveGreen)).BeginInit(); 84 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarDriveRed)).BeginInit(); 85 | this.iMenuStrip.SuspendLayout(); 86 | this.SuspendLayout(); 87 | // 88 | // iComboBoxVirtualMonitors 89 | // 90 | this.iComboBoxVirtualMonitors.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 91 | this.iComboBoxVirtualMonitors.FormattingEnabled = true; 92 | this.iComboBoxVirtualMonitors.Location = new System.Drawing.Point(143, 37); 93 | this.iComboBoxVirtualMonitors.Name = "iComboBoxVirtualMonitors"; 94 | this.iComboBoxVirtualMonitors.Size = new System.Drawing.Size(203, 21); 95 | this.iComboBoxVirtualMonitors.TabIndex = 0; 96 | this.iComboBoxVirtualMonitors.SelectedIndexChanged += new System.EventHandler(this.iComboBoxVirtualMonitors_SelectedIndexChanged); 97 | // 98 | // iButtonRefresh 99 | // 100 | this.iButtonRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 101 | this.iButtonRefresh.Location = new System.Drawing.Point(372, 633); 102 | this.iButtonRefresh.Name = "iButtonRefresh"; 103 | this.iButtonRefresh.Size = new System.Drawing.Size(75, 23); 104 | this.iButtonRefresh.TabIndex = 4; 105 | this.iButtonRefresh.Text = "Refresh"; 106 | this.iButtonRefresh.UseVisualStyleBackColor = true; 107 | this.iButtonRefresh.Click += new System.EventHandler(this.iButtonRefresh_Click); 108 | // 109 | // iLabelVirtualMonitors 110 | // 111 | this.iLabelVirtualMonitors.AutoSize = true; 112 | this.iLabelVirtualMonitors.Location = new System.Drawing.Point(13, 40); 113 | this.iLabelVirtualMonitors.Name = "iLabelVirtualMonitors"; 114 | this.iLabelVirtualMonitors.Size = new System.Drawing.Size(82, 13); 115 | this.iLabelVirtualMonitors.TabIndex = 1; 116 | this.iLabelVirtualMonitors.Text = "Virtual Monitors:"; 117 | // 118 | // iComboBoxPhysicalMonitors 119 | // 120 | this.iComboBoxPhysicalMonitors.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 121 | this.iComboBoxPhysicalMonitors.FormattingEnabled = true; 122 | this.iComboBoxPhysicalMonitors.Location = new System.Drawing.Point(143, 64); 123 | this.iComboBoxPhysicalMonitors.Name = "iComboBoxPhysicalMonitors"; 124 | this.iComboBoxPhysicalMonitors.Size = new System.Drawing.Size(203, 21); 125 | this.iComboBoxPhysicalMonitors.TabIndex = 3; 126 | this.iComboBoxPhysicalMonitors.SelectedIndexChanged += new System.EventHandler(this.iComboBoxPhysicalMonitors_SelectedIndexChanged); 127 | // 128 | // iLabelPhysicalMonitors 129 | // 130 | this.iLabelPhysicalMonitors.AutoSize = true; 131 | this.iLabelPhysicalMonitors.Location = new System.Drawing.Point(13, 67); 132 | this.iLabelPhysicalMonitors.Name = "iLabelPhysicalMonitors"; 133 | this.iLabelPhysicalMonitors.Size = new System.Drawing.Size(92, 13); 134 | this.iLabelPhysicalMonitors.TabIndex = 2; 135 | this.iLabelPhysicalMonitors.Text = "Physical Monitors:"; 136 | // 137 | // iLabelBrightness 138 | // 139 | this.iLabelBrightness.AutoSize = true; 140 | this.iLabelBrightness.Location = new System.Drawing.Point(13, 102); 141 | this.iLabelBrightness.Name = "iLabelBrightness"; 142 | this.iLabelBrightness.Size = new System.Drawing.Size(59, 13); 143 | this.iLabelBrightness.TabIndex = 5; 144 | this.iLabelBrightness.Text = "Brightness:"; 145 | // 146 | // iTrackBarBrightness 147 | // 148 | this.iTrackBarBrightness.Location = new System.Drawing.Point(143, 91); 149 | this.iTrackBarBrightness.Name = "iTrackBarBrightness"; 150 | this.iTrackBarBrightness.Size = new System.Drawing.Size(203, 45); 151 | this.iTrackBarBrightness.TabIndex = 6; 152 | this.iTrackBarBrightness.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 153 | this.iTrackBarBrightness.Scroll += new System.EventHandler(this.iTrackBarBrightness_Scroll); 154 | this.iTrackBarBrightness.ValueChanged += new System.EventHandler(this.iTrackBarBrightness_ValueChanged); 155 | this.iTrackBarBrightness.MouseCaptureChanged += new System.EventHandler(this.iTrackBarBrightness_MouseCaptureChanged); 156 | // 157 | // iLabelBrightnessPercent 158 | // 159 | this.iLabelBrightnessPercent.AutoSize = true; 160 | this.iLabelBrightnessPercent.Location = new System.Drawing.Point(352, 102); 161 | this.iLabelBrightnessPercent.Name = "iLabelBrightnessPercent"; 162 | this.iLabelBrightnessPercent.Size = new System.Drawing.Size(21, 13); 163 | this.iLabelBrightnessPercent.TabIndex = 7; 164 | this.iLabelBrightnessPercent.Text = "0%"; 165 | // 166 | // iLabelContrastPercent 167 | // 168 | this.iLabelContrastPercent.AutoSize = true; 169 | this.iLabelContrastPercent.Location = new System.Drawing.Point(352, 153); 170 | this.iLabelContrastPercent.Name = "iLabelContrastPercent"; 171 | this.iLabelContrastPercent.Size = new System.Drawing.Size(21, 13); 172 | this.iLabelContrastPercent.TabIndex = 10; 173 | this.iLabelContrastPercent.Text = "0%"; 174 | // 175 | // iTrackBarContrast 176 | // 177 | this.iTrackBarContrast.Location = new System.Drawing.Point(143, 142); 178 | this.iTrackBarContrast.Name = "iTrackBarContrast"; 179 | this.iTrackBarContrast.Size = new System.Drawing.Size(203, 45); 180 | this.iTrackBarContrast.TabIndex = 9; 181 | this.iTrackBarContrast.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 182 | this.iTrackBarContrast.Scroll += new System.EventHandler(this.iTrackBarContrast_Scroll); 183 | this.iTrackBarContrast.ValueChanged += new System.EventHandler(this.iTrackBarContrast_ValueChanged); 184 | this.iTrackBarContrast.MouseCaptureChanged += new System.EventHandler(this.iTrackBarContrast_MouseCaptureChanged); 185 | // 186 | // iLabelContrast 187 | // 188 | this.iLabelContrast.AutoSize = true; 189 | this.iLabelContrast.Location = new System.Drawing.Point(13, 153); 190 | this.iLabelContrast.Name = "iLabelContrast"; 191 | this.iLabelContrast.Size = new System.Drawing.Size(49, 13); 192 | this.iLabelContrast.TabIndex = 8; 193 | this.iLabelContrast.Text = "Contrast:"; 194 | // 195 | // iButtonColorReset 196 | // 197 | this.iButtonColorReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 198 | this.iButtonColorReset.Location = new System.Drawing.Point(100, 633); 199 | this.iButtonColorReset.Name = "iButtonColorReset"; 200 | this.iButtonColorReset.Size = new System.Drawing.Size(75, 23); 201 | this.iButtonColorReset.TabIndex = 11; 202 | this.iButtonColorReset.Text = "Color Reset"; 203 | this.iButtonColorReset.UseVisualStyleBackColor = true; 204 | this.iButtonColorReset.Click += new System.EventHandler(this.iButtonColorReset_Click); 205 | // 206 | // iButtonFactoryReset 207 | // 208 | this.iButtonFactoryReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 209 | this.iButtonFactoryReset.Location = new System.Drawing.Point(10, 633); 210 | this.iButtonFactoryReset.Name = "iButtonFactoryReset"; 211 | this.iButtonFactoryReset.Size = new System.Drawing.Size(84, 23); 212 | this.iButtonFactoryReset.TabIndex = 12; 213 | this.iButtonFactoryReset.Text = "Factory Reset"; 214 | this.iButtonFactoryReset.UseVisualStyleBackColor = true; 215 | this.iButtonFactoryReset.Click += new System.EventHandler(this.iButtonFactoryReset_Click); 216 | // 217 | // iLabelMonitorTech 218 | // 219 | this.iLabelMonitorTech.AutoSize = true; 220 | this.iLabelMonitorTech.Location = new System.Drawing.Point(358, 67); 221 | this.iLabelMonitorTech.Name = "iLabelMonitorTech"; 222 | this.iLabelMonitorTech.Size = new System.Drawing.Size(53, 13); 223 | this.iLabelMonitorTech.TabIndex = 13; 224 | this.iLabelMonitorTech.Text = "Unknown"; 225 | // 226 | // iGroupBoxGain 227 | // 228 | this.iGroupBoxGain.Controls.Add(this.iLabelGainBluePercent); 229 | this.iGroupBoxGain.Controls.Add(this.iLabelGainGreenPercent); 230 | this.iGroupBoxGain.Controls.Add(this.iLabelGainRedPercent); 231 | this.iGroupBoxGain.Controls.Add(this.iTrackBarGainBlue); 232 | this.iGroupBoxGain.Controls.Add(this.iLabelGainBlue); 233 | this.iGroupBoxGain.Controls.Add(this.iTrackBarGainGreen); 234 | this.iGroupBoxGain.Controls.Add(this.iLabelGainGreen); 235 | this.iGroupBoxGain.Controls.Add(this.iTrackBarGainRed); 236 | this.iGroupBoxGain.Controls.Add(this.iLabelGainRed); 237 | this.iGroupBoxGain.Location = new System.Drawing.Point(13, 238); 238 | this.iGroupBoxGain.Name = "iGroupBoxGain"; 239 | this.iGroupBoxGain.Size = new System.Drawing.Size(413, 176); 240 | this.iGroupBoxGain.TabIndex = 14; 241 | this.iGroupBoxGain.TabStop = false; 242 | this.iGroupBoxGain.Text = "Gain"; 243 | // 244 | // iLabelGainBluePercent 245 | // 246 | this.iLabelGainBluePercent.AutoSize = true; 247 | this.iLabelGainBluePercent.Location = new System.Drawing.Point(339, 132); 248 | this.iLabelGainBluePercent.Name = "iLabelGainBluePercent"; 249 | this.iLabelGainBluePercent.Size = new System.Drawing.Size(21, 13); 250 | this.iLabelGainBluePercent.TabIndex = 15; 251 | this.iLabelGainBluePercent.Text = "0%"; 252 | // 253 | // iLabelGainGreenPercent 254 | // 255 | this.iLabelGainGreenPercent.AutoSize = true; 256 | this.iLabelGainGreenPercent.Location = new System.Drawing.Point(339, 81); 257 | this.iLabelGainGreenPercent.Name = "iLabelGainGreenPercent"; 258 | this.iLabelGainGreenPercent.Size = new System.Drawing.Size(21, 13); 259 | this.iLabelGainGreenPercent.TabIndex = 14; 260 | this.iLabelGainGreenPercent.Text = "0%"; 261 | // 262 | // iLabelGainRedPercent 263 | // 264 | this.iLabelGainRedPercent.AutoSize = true; 265 | this.iLabelGainRedPercent.Location = new System.Drawing.Point(339, 32); 266 | this.iLabelGainRedPercent.Name = "iLabelGainRedPercent"; 267 | this.iLabelGainRedPercent.Size = new System.Drawing.Size(21, 13); 268 | this.iLabelGainRedPercent.TabIndex = 13; 269 | this.iLabelGainRedPercent.Text = "0%"; 270 | // 271 | // iTrackBarGainBlue 272 | // 273 | this.iTrackBarGainBlue.Location = new System.Drawing.Point(130, 121); 274 | this.iTrackBarGainBlue.Name = "iTrackBarGainBlue"; 275 | this.iTrackBarGainBlue.Size = new System.Drawing.Size(203, 45); 276 | this.iTrackBarGainBlue.TabIndex = 12; 277 | this.iTrackBarGainBlue.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 278 | this.iTrackBarGainBlue.Scroll += new System.EventHandler(this.iTrackBarGainBlue_Scroll); 279 | this.iTrackBarGainBlue.ValueChanged += new System.EventHandler(this.iTrackBarGainBlue_ValueChanged); 280 | this.iTrackBarGainBlue.MouseCaptureChanged += new System.EventHandler(this.iTrackBarGainBlue_MouseCaptureChanged); 281 | // 282 | // iLabelGainBlue 283 | // 284 | this.iLabelGainBlue.AutoSize = true; 285 | this.iLabelGainBlue.Location = new System.Drawing.Point(41, 132); 286 | this.iLabelGainBlue.Name = "iLabelGainBlue"; 287 | this.iLabelGainBlue.Size = new System.Drawing.Size(31, 13); 288 | this.iLabelGainBlue.TabIndex = 11; 289 | this.iLabelGainBlue.Text = "Blue:"; 290 | // 291 | // iTrackBarGainGreen 292 | // 293 | this.iTrackBarGainGreen.Location = new System.Drawing.Point(130, 70); 294 | this.iTrackBarGainGreen.Name = "iTrackBarGainGreen"; 295 | this.iTrackBarGainGreen.Size = new System.Drawing.Size(203, 45); 296 | this.iTrackBarGainGreen.TabIndex = 10; 297 | this.iTrackBarGainGreen.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 298 | this.iTrackBarGainGreen.Scroll += new System.EventHandler(this.iTrackBarGainGreen_Scroll); 299 | this.iTrackBarGainGreen.ValueChanged += new System.EventHandler(this.iTrackBarGainGreen_ValueChanged); 300 | this.iTrackBarGainGreen.MouseCaptureChanged += new System.EventHandler(this.iTrackBarGainGreen_MouseCaptureChanged); 301 | // 302 | // iLabelGainGreen 303 | // 304 | this.iLabelGainGreen.AutoSize = true; 305 | this.iLabelGainGreen.Location = new System.Drawing.Point(41, 81); 306 | this.iLabelGainGreen.Name = "iLabelGainGreen"; 307 | this.iLabelGainGreen.Size = new System.Drawing.Size(39, 13); 308 | this.iLabelGainGreen.TabIndex = 9; 309 | this.iLabelGainGreen.Text = "Green:"; 310 | // 311 | // iTrackBarGainRed 312 | // 313 | this.iTrackBarGainRed.Location = new System.Drawing.Point(130, 19); 314 | this.iTrackBarGainRed.Name = "iTrackBarGainRed"; 315 | this.iTrackBarGainRed.Size = new System.Drawing.Size(203, 45); 316 | this.iTrackBarGainRed.TabIndex = 8; 317 | this.iTrackBarGainRed.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 318 | this.iTrackBarGainRed.Scroll += new System.EventHandler(this.iTrackBarGainRed_Scroll); 319 | this.iTrackBarGainRed.ValueChanged += new System.EventHandler(this.iTrackBarGainRed_ValueChanged); 320 | this.iTrackBarGainRed.MouseCaptureChanged += new System.EventHandler(this.iTrackBarGainRed_MouseCaptureChanged); 321 | // 322 | // iLabelGainRed 323 | // 324 | this.iLabelGainRed.AutoSize = true; 325 | this.iLabelGainRed.Location = new System.Drawing.Point(41, 32); 326 | this.iLabelGainRed.Name = "iLabelGainRed"; 327 | this.iLabelGainRed.Size = new System.Drawing.Size(30, 13); 328 | this.iLabelGainRed.TabIndex = 7; 329 | this.iLabelGainRed.Text = "Red:"; 330 | // 331 | // iLabelColorTemperature 332 | // 333 | this.iLabelColorTemperature.AutoSize = true; 334 | this.iLabelColorTemperature.Location = new System.Drawing.Point(13, 196); 335 | this.iLabelColorTemperature.Name = "iLabelColorTemperature"; 336 | this.iLabelColorTemperature.Size = new System.Drawing.Size(97, 13); 337 | this.iLabelColorTemperature.TabIndex = 16; 338 | this.iLabelColorTemperature.Text = "Color Temperature:"; 339 | // 340 | // iComboBoxColorTemperature 341 | // 342 | this.iComboBoxColorTemperature.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 343 | this.iComboBoxColorTemperature.FormattingEnabled = true; 344 | this.iComboBoxColorTemperature.Location = new System.Drawing.Point(143, 193); 345 | this.iComboBoxColorTemperature.Name = "iComboBoxColorTemperature"; 346 | this.iComboBoxColorTemperature.Size = new System.Drawing.Size(203, 21); 347 | this.iComboBoxColorTemperature.TabIndex = 15; 348 | this.iComboBoxColorTemperature.SelectionChangeCommitted += new System.EventHandler(this.iComboBoxColorTemperature_SelectionChangeCommitted); 349 | // 350 | // iCheckBoxColorTemperatureUnlock 351 | // 352 | this.iCheckBoxColorTemperatureUnlock.AutoSize = true; 353 | this.iCheckBoxColorTemperatureUnlock.Location = new System.Drawing.Point(376, 196); 354 | this.iCheckBoxColorTemperatureUnlock.Name = "iCheckBoxColorTemperatureUnlock"; 355 | this.iCheckBoxColorTemperatureUnlock.Size = new System.Drawing.Size(60, 17); 356 | this.iCheckBoxColorTemperatureUnlock.TabIndex = 17; 357 | this.iCheckBoxColorTemperatureUnlock.Text = "Unlock"; 358 | this.iCheckBoxColorTemperatureUnlock.UseVisualStyleBackColor = true; 359 | this.iCheckBoxColorTemperatureUnlock.CheckedChanged += new System.EventHandler(this.iCheckBoxColorTemperatureUnlock_CheckedChanged); 360 | // 361 | // iLabelDeviceName 362 | // 363 | this.iLabelDeviceName.AutoSize = true; 364 | this.iLabelDeviceName.Location = new System.Drawing.Point(358, 40); 365 | this.iLabelDeviceName.Name = "iLabelDeviceName"; 366 | this.iLabelDeviceName.Size = new System.Drawing.Size(53, 13); 367 | this.iLabelDeviceName.TabIndex = 18; 368 | this.iLabelDeviceName.Text = "Unknown"; 369 | // 370 | // iGroupBoxDrive 371 | // 372 | this.iGroupBoxDrive.Controls.Add(this.iLabelDriveBluePercent); 373 | this.iGroupBoxDrive.Controls.Add(this.iLabelDriveGreenPercent); 374 | this.iGroupBoxDrive.Controls.Add(this.iLabelDriveRedPercent); 375 | this.iGroupBoxDrive.Controls.Add(this.iTrackBarDriveBlue); 376 | this.iGroupBoxDrive.Controls.Add(this.iLabelDriveBlue); 377 | this.iGroupBoxDrive.Controls.Add(this.iTrackBarDriveGreen); 378 | this.iGroupBoxDrive.Controls.Add(this.iLabelDriveGreen); 379 | this.iGroupBoxDrive.Controls.Add(this.iTrackBarDriveRed); 380 | this.iGroupBoxDrive.Controls.Add(this.iLabelDriveRed); 381 | this.iGroupBoxDrive.Location = new System.Drawing.Point(13, 429); 382 | this.iGroupBoxDrive.Name = "iGroupBoxDrive"; 383 | this.iGroupBoxDrive.Size = new System.Drawing.Size(413, 176); 384 | this.iGroupBoxDrive.TabIndex = 19; 385 | this.iGroupBoxDrive.TabStop = false; 386 | this.iGroupBoxDrive.Text = "Drive"; 387 | // 388 | // iLabelDriveBluePercent 389 | // 390 | this.iLabelDriveBluePercent.AutoSize = true; 391 | this.iLabelDriveBluePercent.Location = new System.Drawing.Point(339, 132); 392 | this.iLabelDriveBluePercent.Name = "iLabelDriveBluePercent"; 393 | this.iLabelDriveBluePercent.Size = new System.Drawing.Size(21, 13); 394 | this.iLabelDriveBluePercent.TabIndex = 15; 395 | this.iLabelDriveBluePercent.Text = "0%"; 396 | // 397 | // iLabelDriveGreenPercent 398 | // 399 | this.iLabelDriveGreenPercent.AutoSize = true; 400 | this.iLabelDriveGreenPercent.Location = new System.Drawing.Point(339, 81); 401 | this.iLabelDriveGreenPercent.Name = "iLabelDriveGreenPercent"; 402 | this.iLabelDriveGreenPercent.Size = new System.Drawing.Size(21, 13); 403 | this.iLabelDriveGreenPercent.TabIndex = 14; 404 | this.iLabelDriveGreenPercent.Text = "0%"; 405 | // 406 | // iLabelDriveRedPercent 407 | // 408 | this.iLabelDriveRedPercent.AutoSize = true; 409 | this.iLabelDriveRedPercent.Location = new System.Drawing.Point(339, 32); 410 | this.iLabelDriveRedPercent.Name = "iLabelDriveRedPercent"; 411 | this.iLabelDriveRedPercent.Size = new System.Drawing.Size(21, 13); 412 | this.iLabelDriveRedPercent.TabIndex = 13; 413 | this.iLabelDriveRedPercent.Text = "0%"; 414 | // 415 | // iTrackBarDriveBlue 416 | // 417 | this.iTrackBarDriveBlue.Location = new System.Drawing.Point(130, 121); 418 | this.iTrackBarDriveBlue.Name = "iTrackBarDriveBlue"; 419 | this.iTrackBarDriveBlue.Size = new System.Drawing.Size(203, 45); 420 | this.iTrackBarDriveBlue.TabIndex = 12; 421 | this.iTrackBarDriveBlue.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 422 | this.iTrackBarDriveBlue.Scroll += new System.EventHandler(this.iTrackBarDriveBlue_Scroll); 423 | this.iTrackBarDriveBlue.ValueChanged += new System.EventHandler(this.iTrackBarDriveBlue_ValueChanged); 424 | this.iTrackBarDriveBlue.MouseCaptureChanged += new System.EventHandler(this.iTrackBarDriveBlue_MouseCaptureChanged); 425 | // 426 | // iLabelDriveBlue 427 | // 428 | this.iLabelDriveBlue.AutoSize = true; 429 | this.iLabelDriveBlue.Location = new System.Drawing.Point(41, 132); 430 | this.iLabelDriveBlue.Name = "iLabelDriveBlue"; 431 | this.iLabelDriveBlue.Size = new System.Drawing.Size(31, 13); 432 | this.iLabelDriveBlue.TabIndex = 11; 433 | this.iLabelDriveBlue.Text = "Blue:"; 434 | // 435 | // iTrackBarDriveGreen 436 | // 437 | this.iTrackBarDriveGreen.Location = new System.Drawing.Point(130, 70); 438 | this.iTrackBarDriveGreen.Name = "iTrackBarDriveGreen"; 439 | this.iTrackBarDriveGreen.Size = new System.Drawing.Size(203, 45); 440 | this.iTrackBarDriveGreen.TabIndex = 10; 441 | this.iTrackBarDriveGreen.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 442 | this.iTrackBarDriveGreen.Scroll += new System.EventHandler(this.iTrackBarDriveGreen_Scroll); 443 | this.iTrackBarDriveGreen.ValueChanged += new System.EventHandler(this.iTrackBarDriveGreen_ValueChanged); 444 | this.iTrackBarDriveGreen.MouseCaptureChanged += new System.EventHandler(this.iTrackBarDriveGreen_MouseCaptureChanged); 445 | // 446 | // iLabelDriveGreen 447 | // 448 | this.iLabelDriveGreen.AutoSize = true; 449 | this.iLabelDriveGreen.Location = new System.Drawing.Point(41, 81); 450 | this.iLabelDriveGreen.Name = "iLabelDriveGreen"; 451 | this.iLabelDriveGreen.Size = new System.Drawing.Size(39, 13); 452 | this.iLabelDriveGreen.TabIndex = 9; 453 | this.iLabelDriveGreen.Text = "Green:"; 454 | // 455 | // iTrackBarDriveRed 456 | // 457 | this.iTrackBarDriveRed.Location = new System.Drawing.Point(130, 19); 458 | this.iTrackBarDriveRed.Name = "iTrackBarDriveRed"; 459 | this.iTrackBarDriveRed.Size = new System.Drawing.Size(203, 45); 460 | this.iTrackBarDriveRed.TabIndex = 8; 461 | this.iTrackBarDriveRed.TickStyle = System.Windows.Forms.TickStyle.TopLeft; 462 | this.iTrackBarDriveRed.Scroll += new System.EventHandler(this.iTrackBarDriveRed_Scroll); 463 | this.iTrackBarDriveRed.ValueChanged += new System.EventHandler(this.iTrackBarDriveRed_ValueChanged); 464 | this.iTrackBarDriveRed.MouseCaptureChanged += new System.EventHandler(this.iTrackBarDriveRed_MouseCaptureChanged); 465 | // 466 | // iLabelDriveRed 467 | // 468 | this.iLabelDriveRed.AutoSize = true; 469 | this.iLabelDriveRed.Location = new System.Drawing.Point(41, 32); 470 | this.iLabelDriveRed.Name = "iLabelDriveRed"; 471 | this.iLabelDriveRed.Size = new System.Drawing.Size(30, 13); 472 | this.iLabelDriveRed.TabIndex = 7; 473 | this.iLabelDriveRed.Text = "Red:"; 474 | // 475 | // iMenuStrip 476 | // 477 | this.iMenuStrip.BackColor = System.Drawing.SystemColors.Window; 478 | this.iMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 479 | this.iToolStripMenuItemAbout, 480 | this.iToolStripMenuItemUpdate}); 481 | this.iMenuStrip.Location = new System.Drawing.Point(0, 0); 482 | this.iMenuStrip.Name = "iMenuStrip"; 483 | this.iMenuStrip.Size = new System.Drawing.Size(459, 24); 484 | this.iMenuStrip.TabIndex = 20; 485 | this.iMenuStrip.Text = "Menu"; 486 | // 487 | // iToolStripMenuItemUpdate 488 | // 489 | this.iToolStripMenuItemUpdate.Name = "iToolStripMenuItemUpdate"; 490 | this.iToolStripMenuItemUpdate.Size = new System.Drawing.Size(57, 20); 491 | this.iToolStripMenuItemUpdate.Text = "Update"; 492 | this.iToolStripMenuItemUpdate.Visible = false; 493 | this.iToolStripMenuItemUpdate.Click += new System.EventHandler(this.iToolStripMenuItemUpdate_Click); 494 | // 495 | // iToolStripMenuItemAbout 496 | // 497 | this.iToolStripMenuItemAbout.Name = "iToolStripMenuItemAbout"; 498 | this.iToolStripMenuItemAbout.Size = new System.Drawing.Size(52, 20); 499 | this.iToolStripMenuItemAbout.Text = "About"; 500 | this.iToolStripMenuItemAbout.Click += new System.EventHandler(this.iToolStripMenuItemAbout_Click); 501 | // 502 | // FormMain 503 | // 504 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 505 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 506 | this.BackColor = System.Drawing.SystemColors.Window; 507 | this.ClientSize = new System.Drawing.Size(459, 668); 508 | this.Controls.Add(this.iMenuStrip); 509 | this.Controls.Add(this.iGroupBoxDrive); 510 | this.Controls.Add(this.iLabelDeviceName); 511 | this.Controls.Add(this.iCheckBoxColorTemperatureUnlock); 512 | this.Controls.Add(this.iLabelColorTemperature); 513 | this.Controls.Add(this.iComboBoxColorTemperature); 514 | this.Controls.Add(this.iGroupBoxGain); 515 | this.Controls.Add(this.iLabelMonitorTech); 516 | this.Controls.Add(this.iButtonFactoryReset); 517 | this.Controls.Add(this.iButtonColorReset); 518 | this.Controls.Add(this.iLabelContrastPercent); 519 | this.Controls.Add(this.iTrackBarContrast); 520 | this.Controls.Add(this.iLabelContrast); 521 | this.Controls.Add(this.iLabelBrightnessPercent); 522 | this.Controls.Add(this.iTrackBarBrightness); 523 | this.Controls.Add(this.iLabelBrightness); 524 | this.Controls.Add(this.iButtonRefresh); 525 | this.Controls.Add(this.iComboBoxPhysicalMonitors); 526 | this.Controls.Add(this.iLabelPhysicalMonitors); 527 | this.Controls.Add(this.iLabelVirtualMonitors); 528 | this.Controls.Add(this.iComboBoxVirtualMonitors); 529 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 530 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 531 | this.Name = "FormMain"; 532 | this.Text = "Monitor Configuration Demo"; 533 | this.Shown += new System.EventHandler(this.FormMain_Shown); 534 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarBrightness)).EndInit(); 535 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarContrast)).EndInit(); 536 | this.iGroupBoxGain.ResumeLayout(false); 537 | this.iGroupBoxGain.PerformLayout(); 538 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarGainBlue)).EndInit(); 539 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarGainGreen)).EndInit(); 540 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarGainRed)).EndInit(); 541 | this.iGroupBoxDrive.ResumeLayout(false); 542 | this.iGroupBoxDrive.PerformLayout(); 543 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarDriveBlue)).EndInit(); 544 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarDriveGreen)).EndInit(); 545 | ((System.ComponentModel.ISupportInitialize)(this.iTrackBarDriveRed)).EndInit(); 546 | this.iMenuStrip.ResumeLayout(false); 547 | this.iMenuStrip.PerformLayout(); 548 | this.ResumeLayout(false); 549 | this.PerformLayout(); 550 | 551 | } 552 | 553 | #endregion 554 | 555 | private System.Windows.Forms.ComboBox iComboBoxVirtualMonitors; 556 | private System.Windows.Forms.Button iButtonRefresh; 557 | private System.Windows.Forms.Label iLabelVirtualMonitors; 558 | private System.Windows.Forms.ComboBox iComboBoxPhysicalMonitors; 559 | private System.Windows.Forms.Label iLabelPhysicalMonitors; 560 | private System.Windows.Forms.Label iLabelBrightness; 561 | private System.Windows.Forms.TrackBar iTrackBarBrightness; 562 | private System.Windows.Forms.ToolTip iToolTip; 563 | private System.Windows.Forms.Label iLabelBrightnessPercent; 564 | private System.Windows.Forms.Label iLabelContrastPercent; 565 | private System.Windows.Forms.TrackBar iTrackBarContrast; 566 | private System.Windows.Forms.Label iLabelContrast; 567 | private System.Windows.Forms.Button iButtonColorReset; 568 | private System.Windows.Forms.Button iButtonFactoryReset; 569 | private System.Windows.Forms.Label iLabelMonitorTech; 570 | private System.Windows.Forms.GroupBox iGroupBoxGain; 571 | private System.Windows.Forms.TrackBar iTrackBarGainGreen; 572 | private System.Windows.Forms.Label iLabelGainGreen; 573 | private System.Windows.Forms.TrackBar iTrackBarGainRed; 574 | private System.Windows.Forms.Label iLabelGainRed; 575 | private System.Windows.Forms.TrackBar iTrackBarGainBlue; 576 | private System.Windows.Forms.Label iLabelGainBlue; 577 | private System.Windows.Forms.Label iLabelGainBluePercent; 578 | private System.Windows.Forms.Label iLabelGainGreenPercent; 579 | private System.Windows.Forms.Label iLabelGainRedPercent; 580 | private System.Windows.Forms.Label iLabelColorTemperature; 581 | private System.Windows.Forms.ComboBox iComboBoxColorTemperature; 582 | private System.Windows.Forms.CheckBox iCheckBoxColorTemperatureUnlock; 583 | private System.Windows.Forms.Label iLabelDeviceName; 584 | private System.Windows.Forms.GroupBox iGroupBoxDrive; 585 | private System.Windows.Forms.Label iLabelDriveBluePercent; 586 | private System.Windows.Forms.Label iLabelDriveGreenPercent; 587 | private System.Windows.Forms.Label iLabelDriveRedPercent; 588 | private System.Windows.Forms.TrackBar iTrackBarDriveBlue; 589 | private System.Windows.Forms.Label iLabelDriveBlue; 590 | private System.Windows.Forms.TrackBar iTrackBarDriveGreen; 591 | private System.Windows.Forms.Label iLabelDriveGreen; 592 | private System.Windows.Forms.TrackBar iTrackBarDriveRed; 593 | private System.Windows.Forms.Label iLabelDriveRed; 594 | private System.Windows.Forms.MenuStrip iMenuStrip; 595 | private System.Windows.Forms.ToolStripMenuItem iToolStripMenuItemUpdate; 596 | private System.Windows.Forms.ToolStripMenuItem iToolStripMenuItemAbout; 597 | } 598 | } 599 | 600 | -------------------------------------------------------------------------------- /Project/Demo/FormMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using System.Windows; 11 | using SharpLib.MonitorConfig; 12 | using System.Threading; 13 | //using Squirrel; 14 | using System.Diagnostics; 15 | 16 | namespace MonitorConfigDemo 17 | { 18 | public partial class FormMain : Form 19 | { 20 | Monitors iMonitors; 21 | 22 | public FormMain() 23 | { 24 | InitializeComponent(); 25 | 26 | UpdateMonitors(); 27 | 28 | // Show version in title bar 29 | System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); 30 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); 31 | string version = fvi.FileVersion; 32 | Text += " - v" + version; 33 | } 34 | 35 | /// 36 | /// Check for application update and ask the user to proceed if any. 37 | /// 38 | async void SquirrelUpdate() 39 | { 40 | // Check for Squirrel application update 41 | #if !DEBUG 42 | ReleaseEntry release = null; 43 | using (var mgr = new UpdateManager("http://publish.slions.net/MonitorConfigDemo")) 44 | { 45 | // 46 | UpdateInfo updateInfo = await mgr.CheckForUpdate(); 47 | if (updateInfo.ReleasesToApply.Any()) // Check if we have any update 48 | { 49 | // We have an update ask our user if he wants it 50 | System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); 51 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); 52 | string msg = "New version available!" + 53 | "\n\nCurrent version: " + updateInfo.CurrentlyInstalledVersion.Version + 54 | "\nNew version: " + updateInfo.FutureReleaseEntry.Version + 55 | "\n\nUpdate application now?"; 56 | DialogResult dialogResult = MessageBox.Show(msg, fvi.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); 57 | if (dialogResult == DialogResult.Yes) 58 | { 59 | // User wants it, do the update 60 | release = await mgr.UpdateApp(); 61 | } 62 | else 63 | { 64 | // User cancel an update enable manual update option 65 | iToolStripMenuItemUpdate.Visible = true; 66 | } 67 | } 68 | } 69 | 70 | // Restart the app 71 | if (release!=null) 72 | { 73 | UpdateManager.RestartApp(); 74 | } 75 | #endif 76 | } 77 | 78 | 79 | /// 80 | /// Our virtual monitor was changed. 81 | /// 82 | /// 83 | /// 84 | private void iComboBoxVirtualMonitors_SelectedIndexChanged(object sender, EventArgs e) 85 | { 86 | iLabelDeviceName.Text = CurrentVirtualMonitor().DeviceName; 87 | PopulatePhysicalMonitors(); 88 | } 89 | 90 | /// 91 | /// 92 | /// 93 | private void PopulateColorTemperature() 94 | { 95 | // 96 | iComboBoxColorTemperature.Items.Clear(); 97 | // 98 | if (iCheckBoxColorTemperatureUnlock.Checked) 99 | { 100 | // Unlock mode provides all choices 101 | // This was designed to be able to test Dell monitors not reporting capabilities properly 102 | foreach (ColorTemperature t in Enum.GetValues(typeof(ColorTemperature))) 103 | { 104 | iComboBoxColorTemperature.Items.Add(t); 105 | } 106 | 107 | return; 108 | } 109 | 110 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 111 | ColorTemperature current = pm.ColorTemperature; 112 | // 113 | iComboBoxColorTemperature.Items.Add(ColorTemperature.Unknown); 114 | 115 | // Add supported color temperature to our combo box 116 | // For those Dell monitors not reporting supported color temperature we added the current check 117 | // That makes sure the current profile is in the combo box 118 | 119 | if (pm.SupportsColorTemperature4000K || current== ColorTemperature.K4000) 120 | { 121 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K4000); 122 | } 123 | 124 | if (pm.SupportsColorTemperature5000K || current == ColorTemperature.K5000) 125 | { 126 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K5000); 127 | } 128 | 129 | if (pm.SupportsColorTemperature6500K || current == ColorTemperature.K6500) 130 | { 131 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K6500); 132 | } 133 | 134 | if (pm.SupportsColorTemperature7500K || current == ColorTemperature.K7500) 135 | { 136 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K7500); 137 | } 138 | 139 | if (pm.SupportsColorTemperature8200K || current == ColorTemperature.K8200) 140 | { 141 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K8200); 142 | } 143 | 144 | if (pm.SupportsColorTemperature9300K || current == ColorTemperature.K9300) 145 | { 146 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K9300); 147 | } 148 | 149 | if (pm.SupportsColorTemperature10000K || current == ColorTemperature.K10000) 150 | { 151 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K10000); 152 | } 153 | 154 | if (pm.SupportsColorTemperature11500K || current == ColorTemperature.K11500) 155 | { 156 | iComboBoxColorTemperature.Items.Add(ColorTemperature.K11500); 157 | } 158 | } 159 | 160 | /// 161 | /// 162 | /// 163 | private void PopulateVirtualMonitors() 164 | { 165 | iComboBoxVirtualMonitors.Items.Clear(); 166 | // Populate virtual monitor list 167 | foreach (VirtualMonitor m in iMonitors.VirtualMonitors) 168 | { 169 | String itemText = m.FriendlyName + " ( " + m.Rect.Size.Width + " x " + m.Rect.Size.Height + " )"; 170 | if (m.IsPrimary()) 171 | { 172 | // Mark primary display 173 | itemText += " *"; 174 | } 175 | iComboBoxVirtualMonitors.Items.Add(itemText); 176 | } 177 | 178 | if (iComboBoxVirtualMonitors.Items.Count > 0) //Defensive 179 | { 180 | // Select first monitor 181 | iComboBoxVirtualMonitors.SelectedIndex = 0; 182 | } 183 | } 184 | 185 | 186 | /// 187 | /// 188 | /// 189 | private void PopulatePhysicalMonitors() 190 | { 191 | iComboBoxPhysicalMonitors.Items.Clear(); 192 | // Populate our physical monitor accordingly 193 | VirtualMonitor vm = CurrentVirtualMonitor(); 194 | foreach (PhysicalMonitor pm in vm.PhysicalMonitors) 195 | { 196 | iComboBoxPhysicalMonitors.Items.Add(pm.Description); 197 | } 198 | 199 | if (iComboBoxPhysicalMonitors.Items.Count > 0) //Defensive 200 | { 201 | // Select first monitor 202 | iComboBoxPhysicalMonitors.SelectedIndex = 0; 203 | } 204 | } 205 | 206 | /// 207 | /// 208 | /// 209 | private void UpdateColorTemperature() 210 | { 211 | // Color temperature 212 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 213 | PopulateColorTemperature(); 214 | // We don't enforce disabling color temperature as notably Dell P2312H supports it but pretends it does not. 215 | iComboBoxColorTemperature.Enabled = iCheckBoxColorTemperatureUnlock.Checked || pm.SupportsColorTemperature; 216 | iComboBoxColorTemperature.SelectedItem = pm.ColorTemperature; 217 | } 218 | 219 | /// 220 | /// 221 | /// 222 | private void UpdateMonitors() 223 | { 224 | //if (iMonitors!=null) 225 | //{ 226 | // iMonitors.Dispose(); 227 | // iMonitors = null; 228 | //} 229 | if (iMonitors == null) 230 | { 231 | iMonitors = new Monitors(); 232 | } 233 | iMonitors.Scan(); 234 | PopulateVirtualMonitors(); 235 | } 236 | 237 | /// 238 | /// Update control according to currently selected physical monitor. 239 | /// 240 | private void UpdatePhysicalMonitor() 241 | { 242 | // Get our physical monitor 243 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 244 | 245 | // Reset buttons 246 | iButtonFactoryReset.Enabled = pm.SupportsRestoreFactoryDefaults; 247 | iButtonColorReset.Enabled = pm.SupportsRestoreFactoryColorDefaults; 248 | 249 | // Monitor Technology Type 250 | iLabelMonitorTech.Visible = pm.SupportsTechnologyType; 251 | iLabelMonitorTech.Text = pm.TechnologyTypeName; 252 | 253 | // Brightness update 254 | iTrackBarBrightness.Enabled = 255 | iLabelBrightness.Enabled = 256 | iLabelBrightnessPercent.Visible = pm.SupportsBrightness; 257 | SetupTrackBar(iTrackBarBrightness, pm.Brightness); 258 | 259 | // Contrast update 260 | iTrackBarContrast.Enabled = 261 | iLabelContrast.Enabled = 262 | iLabelContrastPercent.Visible = pm.SupportsContrast; 263 | SetupTrackBar(iTrackBarContrast, pm.Contrast); 264 | 265 | // Color temperature 266 | UpdateColorTemperature(); 267 | 268 | // Gain 269 | iGroupBoxGain.Enabled = pm.SupportsRgbGain; 270 | SetupTrackBar(iTrackBarGainRed, pm.GainRed); 271 | SetupTrackBar(iTrackBarGainGreen, pm.GainGreen); 272 | SetupTrackBar(iTrackBarGainBlue, pm.GainBlue); 273 | 274 | // Drive 275 | iGroupBoxDrive.Enabled = pm.SupportsRgbDrive; 276 | SetupTrackBar(iTrackBarDriveRed, pm.DriveRed); 277 | SetupTrackBar(iTrackBarDriveGreen, pm.DriveGreen); 278 | SetupTrackBar(iTrackBarDriveBlue, pm.DriveBlue); 279 | 280 | } 281 | 282 | /// 283 | /// Setup a trackbar from the provided setting. 284 | /// 285 | /// 286 | /// 287 | static void SetupTrackBar(TrackBar aTrackBar, Setting aSetting) 288 | { 289 | aTrackBar.Minimum = (int)aSetting.Min; 290 | aTrackBar.Maximum = (int)aSetting.Max; 291 | aTrackBar.Value = (int)aSetting.Current; 292 | if (aTrackBar.Maximum % 10 == 0) 293 | { 294 | aTrackBar.TickFrequency = (aTrackBar.Maximum - aTrackBar.Minimum) / 20; 295 | } 296 | else // Assume mod 2 297 | { 298 | aTrackBar.TickFrequency = 8; 299 | } 300 | 301 | 302 | } 303 | 304 | /// 305 | /// 306 | /// 307 | /// 308 | /// 309 | /// 310 | static void UpdateTrackBar(TrackBar aTrackBar, Label aLabel, ToolTip aToolTip) 311 | { 312 | aToolTip.SetToolTip(aTrackBar, aTrackBar.Value.ToString()); 313 | float max = aTrackBar.Maximum - aTrackBar.Minimum; 314 | float current = aTrackBar.Value - aTrackBar.Minimum; 315 | int percent = (int)(current / (max / 100)); 316 | aLabel.Text = percent.ToString() + "%"; 317 | } 318 | 319 | /// 320 | /// 321 | /// 322 | /// 323 | private PhysicalMonitor CurrentPhysicalMonitor() 324 | { 325 | PhysicalMonitor pm = CurrentVirtualMonitor().PhysicalMonitors[iComboBoxPhysicalMonitors.SelectedIndex]; 326 | return pm; 327 | } 328 | 329 | /// 330 | /// 331 | /// 332 | /// 333 | private VirtualMonitor CurrentVirtualMonitor() 334 | { 335 | return iMonitors.VirtualMonitors[iComboBoxVirtualMonitors.SelectedIndex]; 336 | } 337 | 338 | /// 339 | /// 340 | /// 341 | private void WaitForPhysicalMonitorToComeBackOnline() 342 | { 343 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 344 | // Wait for the monitor to come back online 345 | int max = 40; 346 | while (!pm.Construct() && max >= 0) 347 | { 348 | max--; 349 | Thread.Sleep(250); // Added that delay as Dell P2312H is not responsive immediately after reset 350 | } 351 | } 352 | 353 | /// 354 | /// 355 | /// 356 | /// 357 | /// 358 | private void iButtonRefresh_Click(object sender, EventArgs e) 359 | { 360 | UpdateMonitors(); 361 | } 362 | 363 | private void iComboBoxPhysicalMonitors_SelectedIndexChanged(object sender, EventArgs e) 364 | { 365 | UpdatePhysicalMonitor(); 366 | } 367 | 368 | private void iTrackBarBrightness_MouseCaptureChanged(object sender, EventArgs e) 369 | { 370 | // In case other properties were altered by our brightness changes, reload them 371 | UpdatePhysicalMonitor(); 372 | } 373 | 374 | private void iTrackBarBrightness_ValueChanged(object sender, EventArgs e) 375 | { 376 | UpdateTrackBar(iTrackBarBrightness, iLabelBrightnessPercent, iToolTip); 377 | } 378 | 379 | private void iTrackBarBrightness_Scroll(object sender, EventArgs e) 380 | { 381 | // Set brighness 382 | Setting brightness = new Setting((uint)iTrackBarBrightness.Minimum, (uint)iTrackBarBrightness.Value, (uint)iTrackBarBrightness.Maximum); 383 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 384 | pm.Brightness = brightness; 385 | } 386 | 387 | private void iTrackBarContrast_MouseCaptureChanged(object sender, EventArgs e) 388 | { 389 | // Sent when the user stops scrolling 390 | // On DELL U2413 any Drive component actually changes the contrast 391 | // and the contrast changes the Drives, just don't ask 392 | UpdatePhysicalMonitor(); 393 | // Doing the above upon scrolling is too slow so we only do that 394 | // when the user is done scrolling 395 | } 396 | 397 | private void iTrackBarContrast_ValueChanged(object sender, EventArgs e) 398 | { 399 | UpdateTrackBar(iTrackBarContrast, iLabelContrastPercent, iToolTip); 400 | } 401 | 402 | private void iTrackBarContrast_Scroll(object sender, EventArgs e) 403 | { 404 | // Set contrast 405 | Setting contrast = new Setting((uint)iTrackBarContrast.Minimum, (uint)iTrackBarContrast.Value, (uint)iTrackBarContrast.Maximum); 406 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 407 | pm.Contrast = contrast; 408 | } 409 | 410 | private void iButtonFactoryReset_Click(object sender, EventArgs e) 411 | { 412 | // Initiate reset 413 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 414 | pm.RestoreFactoryDefaults(); 415 | WaitForPhysicalMonitorToComeBackOnline(); 416 | // Update our UI 417 | UpdatePhysicalMonitor(); 418 | } 419 | 420 | private void iButtonColorReset_Click(object sender, EventArgs e) 421 | { 422 | // Initiate reset 423 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 424 | pm.RestoreFactoryColorDefault(); 425 | WaitForPhysicalMonitorToComeBackOnline(); 426 | // Update our UI 427 | UpdatePhysicalMonitor(); 428 | } 429 | 430 | //// 431 | 432 | private void iTrackBarGainRed_MouseCaptureChanged(object sender, EventArgs e) 433 | { 434 | // When user is down scrolling update all properties 435 | UpdatePhysicalMonitor(); 436 | } 437 | 438 | private void iTrackBarGainRed_ValueChanged(object sender, EventArgs e) 439 | { 440 | UpdateTrackBar(iTrackBarGainRed, iLabelGainRedPercent, iToolTip); 441 | } 442 | 443 | private void iTrackBarGainRed_Scroll(object sender, EventArgs e) 444 | { 445 | // Set gain red 446 | Setting red = new Setting((uint)iTrackBarGainRed.Minimum, (uint)iTrackBarGainRed.Value, (uint)iTrackBarGainRed.Maximum); 447 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 448 | pm.GainRed = red; 449 | } 450 | 451 | ///// 452 | 453 | private void iTrackBarGainGreen_MouseCaptureChanged(object sender, EventArgs e) 454 | { 455 | // When user is down scrolling update all properties 456 | UpdatePhysicalMonitor(); 457 | } 458 | 459 | private void iTrackBarGainGreen_ValueChanged(object sender, EventArgs e) 460 | { 461 | UpdateTrackBar(iTrackBarGainGreen, iLabelGainGreenPercent, iToolTip); 462 | } 463 | 464 | private void iTrackBarGainGreen_Scroll(object sender, EventArgs e) 465 | { 466 | // Set gain green 467 | Setting green = new Setting((uint)iTrackBarGainGreen.Minimum, (uint)iTrackBarGainGreen.Value, (uint)iTrackBarGainGreen.Maximum); 468 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 469 | pm.GainGreen = green; 470 | UpdateColorTemperature(); 471 | } 472 | 473 | ///// 474 | 475 | private void iTrackBarGainBlue_MouseCaptureChanged(object sender, EventArgs e) 476 | { 477 | // When user is down scrolling update all properties 478 | UpdatePhysicalMonitor(); 479 | } 480 | 481 | private void iTrackBarGainBlue_ValueChanged(object sender, EventArgs e) 482 | { 483 | UpdateTrackBar(iTrackBarGainBlue, iLabelGainBluePercent, iToolTip); 484 | } 485 | 486 | private void iTrackBarGainBlue_Scroll(object sender, EventArgs e) 487 | { 488 | // Set gain red 489 | Setting blue = new Setting((uint)iTrackBarGainBlue.Minimum, (uint)iTrackBarGainBlue.Value, (uint)iTrackBarGainBlue.Maximum); 490 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 491 | pm.GainBlue = blue; 492 | UpdateColorTemperature(); 493 | } 494 | 495 | private void iComboBoxColorTemperature_SelectionChangeCommitted(object sender, EventArgs e) 496 | { 497 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 498 | pm.ColorTemperature = (ColorTemperature)iComboBoxColorTemperature.SelectedItem; 499 | WaitForPhysicalMonitorToComeBackOnline(); // Dell U2413 was being too slow again 500 | // We will need to fetch the new color settings 501 | // In fact changing color temperature often just changes color gain to some predefined value 502 | UpdatePhysicalMonitor(); 503 | } 504 | 505 | private void iCheckBoxColorTemperatureUnlock_CheckedChanged(object sender, EventArgs e) 506 | { 507 | UpdateColorTemperature(); 508 | } 509 | 510 | ///// 511 | 512 | private void iTrackBarDriveRed_MouseCaptureChanged(object sender, EventArgs e) 513 | { 514 | // On DELL U2413 any Drive component actually changes the contrast 515 | UpdatePhysicalMonitor(); 516 | } 517 | 518 | private void iTrackBarDriveRed_ValueChanged(object sender, EventArgs e) 519 | { 520 | UpdateTrackBar(iTrackBarDriveRed, iLabelDriveRedPercent, iToolTip); 521 | } 522 | 523 | private void iTrackBarDriveRed_Scroll(object sender, EventArgs e) 524 | { 525 | // Set Drive red 526 | Setting red = new Setting((uint)iTrackBarDriveRed.Minimum, (uint)iTrackBarDriveRed.Value, (uint)iTrackBarDriveRed.Maximum); 527 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 528 | pm.DriveRed = red; 529 | } 530 | 531 | ///// 532 | 533 | private void iTrackBarDriveGreen_MouseCaptureChanged(object sender, EventArgs e) 534 | { 535 | // On DELL U2413 any Drive component actually changes the contrast 536 | UpdatePhysicalMonitor(); 537 | } 538 | 539 | private void iTrackBarDriveGreen_ValueChanged(object sender, EventArgs e) 540 | { 541 | // On DELL U2413 any Drive component actually changes the contrast 542 | UpdateTrackBar(iTrackBarDriveGreen, iLabelDriveGreenPercent, iToolTip); 543 | } 544 | 545 | private void iTrackBarDriveGreen_Scroll(object sender, EventArgs e) 546 | { 547 | // Set Drive green 548 | Setting green = new Setting((uint)iTrackBarDriveGreen.Minimum, (uint)iTrackBarDriveGreen.Value, (uint)iTrackBarDriveGreen.Maximum); 549 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 550 | pm.DriveGreen = green; 551 | } 552 | 553 | ///// 554 | 555 | private void iTrackBarDriveBlue_MouseCaptureChanged(object sender, EventArgs e) 556 | { 557 | 558 | } 559 | 560 | private void iTrackBarDriveBlue_ValueChanged(object sender, EventArgs e) 561 | { 562 | UpdateTrackBar(iTrackBarDriveBlue, iLabelDriveBluePercent, iToolTip); 563 | } 564 | 565 | private void iTrackBarDriveBlue_Scroll(object sender, EventArgs e) 566 | { 567 | // Set Drive red 568 | Setting blue = new Setting((uint)iTrackBarDriveBlue.Minimum, (uint)iTrackBarDriveBlue.Value, (uint)iTrackBarDriveBlue.Maximum); 569 | PhysicalMonitor pm = CurrentPhysicalMonitor(); 570 | pm.DriveBlue = blue; 571 | // On DELL U2413 any Drive component actually changes the contrast 572 | UpdatePhysicalMonitor(); 573 | } 574 | 575 | async private void FormMain_Shown(object sender, EventArgs e) 576 | { 577 | SquirrelUpdate(); 578 | } 579 | 580 | async private void iToolStripMenuItemUpdate_Click(object sender, EventArgs e) 581 | { 582 | SquirrelUpdate(); 583 | } 584 | 585 | private void iToolStripMenuItemAbout_Click(object sender, EventArgs e) 586 | { 587 | AboutBox box = new AboutBox(); 588 | box.ShowDialog(); 589 | } 590 | } 591 | } 592 | -------------------------------------------------------------------------------- /Project/Demo/MonitorConfigDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0-windows10.0.26100.0 4 | WinExe 5 | publish\ 6 | true 7 | Disk 8 | false 9 | Foreground 10 | 7 11 | Days 12 | false 13 | false 14 | true 15 | 0 16 | 1.0.0.%2a 17 | false 18 | false 19 | true 20 | true 21 | true 22 | Resources\AppIcon.ico 23 | 7.0 24 | 25 | 26 | 27 | Component 28 | 29 | 30 | 31 | 32 | 33 | all 34 | runtime; build; native; contentfiles; analyzers; buildtransitive 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 58 | 59 | 60 | 61 | 62 | Tools\Squirrel.exe 63 | 64 | 65 | Tools\NuGet.exe 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Project/Demo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace MonitorConfigDemo 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new FormMain()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Project/Demo/Properties/Resources.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 MonitorConfigDemo.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 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 | 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 | /// Returns the cached ResourceManager instance used by this class. 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("MonitorConfigDemo.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 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 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap AboutImage { 67 | get { 68 | object obj = ResourceManager.GetObject("AboutImage", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 75 | /// 76 | internal static System.Drawing.Icon AppIcon { 77 | get { 78 | object obj = ResourceManager.GetObject("AppIcon", resourceCulture); 79 | return ((System.Drawing.Icon)(obj)); 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Project/Demo/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 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\AboutImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\AppIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | -------------------------------------------------------------------------------- /Project/Demo/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 MonitorConfigDemo.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 | -------------------------------------------------------------------------------- /Project/Demo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Project/Demo/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "MonitorConfigDemo": { 4 | "commandName": "Project", 5 | "nativeDebugging": true 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Project/Demo/Resources/AboutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slion/SharpLibMonitorConfig/2a37e6f23bfb3f10df4908529c1f73c5084e3aab/Project/Demo/Resources/AboutImage.png -------------------------------------------------------------------------------- /Project/Demo/Resources/AppIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Slion/SharpLibMonitorConfig/2a37e6f23bfb3f10df4908529c1f73c5084e3aab/Project/Demo/Resources/AppIcon.ico -------------------------------------------------------------------------------- /Project/Demo/RichTextBoxEx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace RichTextBoxLinks 8 | { 9 | /// 10 | /// See: http://www.codeproject.com/Articles/9196/Links-with-arbitrary-text-in-a-RichTextBox 11 | /// 12 | public class RichTextBoxEx : RichTextBox 13 | { 14 | #region Interop-Defines 15 | [ StructLayout( LayoutKind.Sequential )] 16 | private struct CHARFORMAT2_STRUCT 17 | { 18 | public UInt32 cbSize; 19 | public UInt32 dwMask; 20 | public UInt32 dwEffects; 21 | public Int32 yHeight; 22 | public Int32 yOffset; 23 | public Int32 crTextColor; 24 | public byte bCharSet; 25 | public byte bPitchAndFamily; 26 | [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] 27 | public char[] szFaceName; 28 | public UInt16 wWeight; 29 | public UInt16 sSpacing; 30 | public int crBackColor; // Color.ToArgb() -> int 31 | public int lcid; 32 | public int dwReserved; 33 | public Int16 sStyle; 34 | public Int16 wKerning; 35 | public byte bUnderlineType; 36 | public byte bAnimation; 37 | public byte bRevAuthor; 38 | public byte bReserved1; 39 | } 40 | 41 | [DllImport("user32.dll", CharSet=CharSet.Auto)] 42 | private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); 43 | 44 | private const int WM_USER = 0x0400; 45 | private const int EM_GETCHARFORMAT = WM_USER+58; 46 | private const int EM_SETCHARFORMAT = WM_USER+68; 47 | 48 | private const int SCF_SELECTION = 0x0001; 49 | private const int SCF_WORD = 0x0002; 50 | private const int SCF_ALL = 0x0004; 51 | 52 | #region CHARFORMAT2 Flags 53 | private const UInt32 CFE_BOLD = 0x0001; 54 | private const UInt32 CFE_ITALIC = 0x0002; 55 | private const UInt32 CFE_UNDERLINE = 0x0004; 56 | private const UInt32 CFE_STRIKEOUT = 0x0008; 57 | private const UInt32 CFE_PROTECTED = 0x0010; 58 | private const UInt32 CFE_LINK = 0x0020; 59 | private const UInt32 CFE_AUTOCOLOR = 0x40000000; 60 | private const UInt32 CFE_SUBSCRIPT = 0x00010000; /* Superscript and subscript are */ 61 | private const UInt32 CFE_SUPERSCRIPT= 0x00020000; /* mutually exclusive */ 62 | 63 | private const int CFM_SMALLCAPS = 0x0040; /* (*) */ 64 | private const int CFM_ALLCAPS = 0x0080; /* Displayed by 3.0 */ 65 | private const int CFM_HIDDEN = 0x0100; /* Hidden by 3.0 */ 66 | private const int CFM_OUTLINE = 0x0200; /* (*) */ 67 | private const int CFM_SHADOW = 0x0400; /* (*) */ 68 | private const int CFM_EMBOSS = 0x0800; /* (*) */ 69 | private const int CFM_IMPRINT = 0x1000; /* (*) */ 70 | private const int CFM_DISABLED = 0x2000; 71 | private const int CFM_REVISED = 0x4000; 72 | 73 | private const int CFM_BACKCOLOR = 0x04000000; 74 | private const int CFM_LCID = 0x02000000; 75 | private const int CFM_UNDERLINETYPE = 0x00800000; /* Many displayed by 3.0 */ 76 | private const int CFM_WEIGHT = 0x00400000; 77 | private const int CFM_SPACING = 0x00200000; /* Displayed by 3.0 */ 78 | private const int CFM_KERNING = 0x00100000; /* (*) */ 79 | private const int CFM_STYLE = 0x00080000; /* (*) */ 80 | private const int CFM_ANIMATION = 0x00040000; /* (*) */ 81 | private const int CFM_REVAUTHOR = 0x00008000; 82 | 83 | 84 | private const UInt32 CFM_BOLD = 0x00000001; 85 | private const UInt32 CFM_ITALIC = 0x00000002; 86 | private const UInt32 CFM_UNDERLINE = 0x00000004; 87 | private const UInt32 CFM_STRIKEOUT = 0x00000008; 88 | private const UInt32 CFM_PROTECTED = 0x00000010; 89 | private const UInt32 CFM_LINK = 0x00000020; 90 | private const UInt32 CFM_SIZE = 0x80000000; 91 | private const UInt32 CFM_COLOR = 0x40000000; 92 | private const UInt32 CFM_FACE = 0x20000000; 93 | private const UInt32 CFM_OFFSET = 0x10000000; 94 | private const UInt32 CFM_CHARSET = 0x08000000; 95 | private const UInt32 CFM_SUBSCRIPT = CFE_SUBSCRIPT | CFE_SUPERSCRIPT; 96 | private const UInt32 CFM_SUPERSCRIPT= CFM_SUBSCRIPT; 97 | 98 | private const byte CFU_UNDERLINENONE = 0x00000000; 99 | private const byte CFU_UNDERLINE = 0x00000001; 100 | private const byte CFU_UNDERLINEWORD = 0x00000002; /* (*) displayed as ordinary underline */ 101 | private const byte CFU_UNDERLINEDOUBLE = 0x00000003; /* (*) displayed as ordinary underline */ 102 | private const byte CFU_UNDERLINEDOTTED = 0x00000004; 103 | private const byte CFU_UNDERLINEDASH = 0x00000005; 104 | private const byte CFU_UNDERLINEDASHDOT = 0x00000006; 105 | private const byte CFU_UNDERLINEDASHDOTDOT = 0x00000007; 106 | private const byte CFU_UNDERLINEWAVE = 0x00000008; 107 | private const byte CFU_UNDERLINETHICK = 0x00000009; 108 | private const byte CFU_UNDERLINEHAIRLINE = 0x0000000A; /* (*) displayed as ordinary underline */ 109 | 110 | #endregion 111 | 112 | #endregion 113 | 114 | public RichTextBoxEx() 115 | { 116 | // Otherwise, non-standard links get lost when user starts typing 117 | // next to a non-standard link 118 | this.DetectUrls = false; 119 | } 120 | 121 | [DefaultValue(false)] 122 | public new bool DetectUrls 123 | { 124 | get { return base.DetectUrls; } 125 | set { base.DetectUrls = value; } 126 | } 127 | 128 | /// 129 | /// Insert a given text as a link into the RichTextBox at the current insert position. 130 | /// 131 | /// Text to be inserted 132 | public void InsertLink(string text) 133 | { 134 | InsertLink(text, this.SelectionStart); 135 | } 136 | 137 | /// 138 | /// Insert a given text at a given position as a link. 139 | /// 140 | /// Text to be inserted 141 | /// Insert position 142 | public void InsertLink(string text, int position) 143 | { 144 | if (position < 0 || position > this.Text.Length) 145 | throw new ArgumentOutOfRangeException("position"); 146 | 147 | this.SelectionStart = position; 148 | this.SelectedText = text; 149 | this.Select(position, text.Length); 150 | this.SetSelectionLink(true); 151 | this.Select(position + text.Length, 0); 152 | } 153 | 154 | /// 155 | /// Insert a given text at at the current input position as a link. 156 | /// The link text is followed by a hash (#) and the given hyperlink text, both of 157 | /// them invisible. 158 | /// When clicked on, the whole link text and hyperlink string are given in the 159 | /// LinkClickedEventArgs. 160 | /// 161 | /// Text to be inserted 162 | /// Invisible hyperlink string to be inserted 163 | public void InsertLink(string text, string hyperlink) 164 | { 165 | InsertLink(text, hyperlink, this.SelectionStart); 166 | } 167 | 168 | /// 169 | /// Insert a given text at a given position as a link. The link text is followed by 170 | /// a hash (#) and the given hyperlink text, both of them invisible. 171 | /// When clicked on, the whole link text and hyperlink string are given in the 172 | /// LinkClickedEventArgs. 173 | /// 174 | /// Text to be inserted 175 | /// Invisible hyperlink string to be inserted 176 | /// Insert position 177 | public void InsertLink(string text, string hyperlink, int position) 178 | { 179 | if (position < 0 || position > this.Text.Length) 180 | throw new ArgumentOutOfRangeException("position"); 181 | 182 | this.SelectionStart = position; 183 | this.SelectedRtf = @"{\rtf1\ansi "+text+@"\v #"+hyperlink+@"\v0}"; 184 | this.Select(position, text.Length + hyperlink.Length + 1); 185 | this.SetSelectionLink(true); 186 | this.Select(position + text.Length + hyperlink.Length + 1, 0); 187 | } 188 | 189 | /// 190 | /// Set the current selection's link style 191 | /// 192 | /// true: set link style, false: clear link style 193 | public void SetSelectionLink(bool link) 194 | { 195 | SetSelectionStyle(CFM_LINK, link ? CFE_LINK : 0); 196 | } 197 | /// 198 | /// Get the link style for the current selection 199 | /// 200 | /// 0: link style not set, 1: link style set, -1: mixed 201 | public int GetSelectionLink() 202 | { 203 | return GetSelectionStyle(CFM_LINK, CFE_LINK); 204 | } 205 | 206 | 207 | private void SetSelectionStyle(UInt32 mask, UInt32 effect) 208 | { 209 | CHARFORMAT2_STRUCT cf = new CHARFORMAT2_STRUCT(); 210 | cf.cbSize = (UInt32)Marshal.SizeOf(cf); 211 | cf.dwMask = mask; 212 | cf.dwEffects = effect; 213 | 214 | IntPtr wpar = new IntPtr(SCF_SELECTION); 215 | IntPtr lpar = Marshal.AllocCoTaskMem( Marshal.SizeOf( cf ) ); 216 | Marshal.StructureToPtr(cf, lpar, false); 217 | 218 | IntPtr res = SendMessage(Handle, EM_SETCHARFORMAT, wpar, lpar); 219 | 220 | Marshal.FreeCoTaskMem(lpar); 221 | } 222 | 223 | private int GetSelectionStyle(UInt32 mask, UInt32 effect) 224 | { 225 | CHARFORMAT2_STRUCT cf = new CHARFORMAT2_STRUCT(); 226 | cf.cbSize = (UInt32)Marshal.SizeOf(cf); 227 | cf.szFaceName = new char[32]; 228 | 229 | IntPtr wpar = new IntPtr(SCF_SELECTION); 230 | IntPtr lpar = Marshal.AllocCoTaskMem( Marshal.SizeOf( cf ) ); 231 | Marshal.StructureToPtr(cf, lpar, false); 232 | 233 | IntPtr res = SendMessage(Handle, EM_GETCHARFORMAT, wpar, lpar); 234 | 235 | cf = (CHARFORMAT2_STRUCT)Marshal.PtrToStructure(lpar, typeof(CHARFORMAT2_STRUCT)); 236 | 237 | int state; 238 | // dwMask holds the information which properties are consistent throughout the selection: 239 | if ((cf.dwMask & mask) == mask) 240 | { 241 | if ((cf.dwEffects & effect) == effect) 242 | state = 1; 243 | else 244 | state = 0; 245 | } 246 | else 247 | { 248 | state = -1; 249 | } 250 | 251 | Marshal.FreeCoTaskMem(lpar); 252 | return state; 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /Project/Demo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Project/Lib/ColorTemperature.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | 6 | using namespace System; 7 | 8 | namespace SharpLib::MonitorConfig 9 | { 10 | public enum class ColorTemperature 11 | { 12 | Unknown = MC_COLOR_TEMPERATURE_UNKNOWN, 13 | K4000 = MC_COLOR_TEMPERATURE_4000K, 14 | K5000 = MC_COLOR_TEMPERATURE_5000K, 15 | K6500 = MC_COLOR_TEMPERATURE_6500K, 16 | K7500 = MC_COLOR_TEMPERATURE_7500K, 17 | K8200 = MC_COLOR_TEMPERATURE_8200K, 18 | K9300 = MC_COLOR_TEMPERATURE_9300K, 19 | K10000 = MC_COLOR_TEMPERATURE_10000K, 20 | K11500 = MC_COLOR_TEMPERATURE_11500K 21 | }; 22 | 23 | } -------------------------------------------------------------------------------- /Project/Lib/Monitors.cpp: -------------------------------------------------------------------------------- 1 | // This is the main DLL file. 2 | 3 | #include "Monitors.h" 4 | 5 | namespace SharpLib::MonitorConfig 6 | { 7 | /// 8 | BOOL CALLBACK MonitorEnumCallback(HMONITOR aMonitor, HDC aHdc, LPRECT aRect, LPARAM aParam) 9 | { 10 | // Unpack our object 11 | gcroot* self = (gcroot*)aParam; 12 | // Add our virtual monitor 13 | (*self)->VirtualMonitors->Add(gcnew VirtualMonitor(aMonitor, (*self)->VirtualMonitors->Count)); 14 | // Done here 15 | return TRUE; 16 | } 17 | 18 | Monitors::Monitors() 19 | { 20 | Construct(); 21 | } 22 | 23 | Monitors::~Monitors() 24 | { 25 | this->!Monitors(); 26 | } 27 | 28 | Monitors::!Monitors() 29 | { 30 | Destruct(); 31 | } 32 | 33 | void Monitors::Construct() 34 | { 35 | VirtualMonitors = gcnew List(); 36 | } 37 | 38 | void Monitors::Destruct() 39 | { 40 | if (VirtualMonitors != nullptr) 41 | { 42 | for each (VirtualMonitor^ vm in VirtualMonitors) 43 | { 44 | delete vm; 45 | } 46 | VirtualMonitors->Clear(); 47 | delete VirtualMonitors; 48 | VirtualMonitors = nullptr; 49 | } 50 | } 51 | 52 | bool Monitors::Scan() 53 | { 54 | Destruct(); 55 | Construct(); 56 | // Package into native type as per: http://stackoverflow.com/a/4163378/3969362 57 | gcroot* self = new gcroot(this); 58 | bool success = EnumDisplayMonitors(NULL, NULL, MonitorEnumCallback, (LPARAM)self) != 0; 59 | delete self; 60 | return success; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Project/Lib/Monitors.h: -------------------------------------------------------------------------------- 1 | // SharpLibMonitorConfig.h 2 | 3 | #pragma once 4 | #include 5 | #include < vcclr.h > 6 | #include "VirtualMonitor.h" 7 | 8 | using namespace System; 9 | using namespace System::Collections::Generic; 10 | 11 | 12 | namespace SharpLib::MonitorConfig 13 | { 14 | 15 | /// 16 | /// 17 | /// 18 | public ref class Monitors 19 | { 20 | // TODO: Add your methods for this class here. 21 | public: 22 | Monitors(); 23 | ~Monitors(); 24 | !Monitors(); 25 | 26 | property List^ VirtualMonitors; 27 | 28 | bool Scan(); 29 | 30 | private: 31 | void Construct(); 32 | void Destruct(); 33 | 34 | }; 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Project/Lib/PhysicalMonitor.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "PhysicalMonitor.h" 3 | 4 | #include 5 | 6 | using namespace System; 7 | 8 | 9 | 10 | namespace SharpLib::MonitorConfig 11 | { 12 | 13 | PhysicalMonitor::PhysicalMonitor(PHYSICAL_MONITOR* aData) : iData(aData) 14 | { 15 | // Provide description 16 | Description = gcnew System::String(iData->szPhysicalMonitorDescription); 17 | Construct(); 18 | } 19 | 20 | bool PhysicalMonitor::Construct() 21 | { 22 | // 23 | iTechnologyTypeName = String::Empty; 24 | 25 | // Get capabilities 26 | DWORD monitorCapabilities = 0; 27 | DWORD supportedColorTemperatures = 0; 28 | bool online = GetMonitorCapabilities(Handle, &monitorCapabilities, &supportedColorTemperatures)==TRUE; 29 | 30 | iMonitorCapabilities = monitorCapabilities; 31 | iSupportedColorTemperatures = supportedColorTemperatures; 32 | 33 | return online; 34 | } 35 | 36 | PhysicalMonitor::~PhysicalMonitor() 37 | { 38 | this->!PhysicalMonitor(); 39 | } 40 | 41 | PhysicalMonitor::!PhysicalMonitor() 42 | { 43 | delete Description; 44 | Description = nullptr; 45 | } 46 | 47 | /// 48 | /// Perform factory reset 49 | /// 50 | void PhysicalMonitor::RestoreFactoryDefaults() 51 | { 52 | RestoreMonitorFactoryDefaults(Handle); 53 | } 54 | 55 | /// 56 | /// Perform factory color reset 57 | /// 58 | void PhysicalMonitor::RestoreFactoryColorDefault() 59 | { 60 | RestoreMonitorFactoryColorDefaults(Handle); 61 | } 62 | 63 | /// 64 | void PhysicalMonitor::GetTechnologyTypeName() 65 | { 66 | MC_DISPLAY_TECHNOLOGY_TYPE type; 67 | if (GetMonitorTechnologyType(Handle, &type)) 68 | { 69 | switch (type) 70 | { 71 | case MC_SHADOW_MASK_CATHODE_RAY_TUBE: 72 | iTechnologyTypeName = "Shadow Mask Cathode Ray Tube"; 73 | break; 74 | case MC_APERTURE_GRILL_CATHODE_RAY_TUBE: 75 | iTechnologyTypeName = "Aperture Grill Cathode Ray Tube"; 76 | break; 77 | case MC_THIN_FILM_TRANSISTOR: 78 | iTechnologyTypeName = "TFT LCD"; 79 | break; 80 | case MC_LIQUID_CRYSTAL_ON_SILICON: 81 | iTechnologyTypeName = "LCD"; 82 | break; 83 | case MC_PLASMA: 84 | iTechnologyTypeName = "Plasma"; 85 | break; 86 | case MC_ORGANIC_LIGHT_EMITTING_DIODE: 87 | iTechnologyTypeName = "OLED"; 88 | break; 89 | case MC_ELECTROLUMINESCENT: 90 | iTechnologyTypeName = "Electroluminescent"; 91 | break; 92 | case MC_MICROELECTROMECHANICAL: 93 | iTechnologyTypeName = "Microelectromechanical"; 94 | break; 95 | case MC_FIELD_EMISSION_DEVICE: 96 | iTechnologyTypeName = "Field Emission Device"; 97 | break; 98 | } 99 | 100 | return; 101 | } 102 | 103 | iTechnologyTypeName = "Unknown"; 104 | } 105 | 106 | /// 107 | String^ PhysicalMonitor::TechnologyTypeName::get() 108 | { 109 | if (String::IsNullOrEmpty(iTechnologyTypeName)) 110 | { 111 | GetTechnologyTypeName(); 112 | } 113 | 114 | return iTechnologyTypeName; 115 | } 116 | 117 | 118 | 119 | /// 120 | /// 121 | /// 122 | Setting^ PhysicalMonitor::Brightness::get() 123 | { 124 | DWORD min=0; 125 | DWORD max=0; 126 | DWORD current=0; 127 | // Get our values 128 | BOOL success = GetMonitorBrightness(Handle, &min, ¤t, &max); 129 | // Set our value 130 | iBrightness.Current = current; 131 | iBrightness.Min = min; 132 | iBrightness.Max = max; 133 | // Provide them 134 | return %iBrightness; 135 | } 136 | 137 | /// 138 | void PhysicalMonitor::Brightness::set(Setting^ aBrigthness) 139 | { 140 | BOOL success = SetMonitorBrightness(Handle, aBrigthness->Current); 141 | } 142 | 143 | // 144 | // Constrast 145 | // 146 | 147 | /// 148 | Setting^ PhysicalMonitor::Contrast::get() 149 | { 150 | DWORD min = 0; 151 | DWORD max = 0; 152 | DWORD current = 0; 153 | // Get our values 154 | BOOL success = GetMonitorContrast(Handle, &min, ¤t, &max); 155 | // Set our value 156 | iContrast.Current = current; 157 | iContrast.Min = min; 158 | iContrast.Max = max; 159 | // Provide them 160 | return %iContrast; 161 | } 162 | 163 | /// 164 | void PhysicalMonitor::Contrast::set(Setting^ aContrast) 165 | { 166 | BOOL success = SetMonitorContrast(Handle, aContrast->Current); 167 | } 168 | 169 | // 170 | // Color Temperature 171 | // 172 | 173 | ColorTemperature PhysicalMonitor::ColorTemperature::get() 174 | { 175 | SharpLib::MonitorConfig::ColorTemperature t = SharpLib::MonitorConfig::ColorTemperature::Unknown; 176 | MC_COLOR_TEMPERATURE temp = MC_COLOR_TEMPERATURE_UNKNOWN; 177 | BOOL success = GetMonitorColorTemperature(Handle, &temp); 178 | t = (SharpLib::MonitorConfig::ColorTemperature)temp; 179 | return t; 180 | } 181 | 182 | void PhysicalMonitor::ColorTemperature::set(SharpLib::MonitorConfig::ColorTemperature aColorTemperature) 183 | { 184 | MC_COLOR_TEMPERATURE temp = (MC_COLOR_TEMPERATURE)aColorTemperature; 185 | BOOL success = SetMonitorColorTemperature(Handle, temp); 186 | } 187 | 188 | 189 | /// 190 | /// 191 | /// 192 | Setting^ PhysicalMonitor::GainRed::get() 193 | { 194 | DWORD min = 0; 195 | DWORD max = 0; 196 | DWORD current = 0; 197 | // Get our values 198 | BOOL success = GetMonitorRedGreenOrBlueGain(Handle, MC_RED_GAIN, &min, ¤t, &max); 199 | // Set our value 200 | iGainRed.Current = current; 201 | iGainRed.Min = min; 202 | iGainRed.Max = max; 203 | // Provide them 204 | return %iGainRed; 205 | } 206 | 207 | /// 208 | void PhysicalMonitor::GainRed::set(Setting^ aSetting) 209 | { 210 | BOOL success = SetMonitorRedGreenOrBlueGain(Handle, MC_RED_GAIN, aSetting->Current); 211 | } 212 | 213 | /// 214 | /// 215 | /// 216 | Setting^ PhysicalMonitor::GainGreen::get() 217 | { 218 | DWORD min = 0; 219 | DWORD max = 0; 220 | DWORD current = 0; 221 | // Get our values 222 | BOOL success = GetMonitorRedGreenOrBlueGain(Handle, MC_GREEN_GAIN, &min, ¤t, &max); 223 | // Set our value 224 | iGainGreen.Current = current; 225 | iGainGreen.Min = min; 226 | iGainGreen.Max = max; 227 | // Provide them 228 | return %iGainGreen; 229 | } 230 | 231 | /// 232 | void PhysicalMonitor::GainGreen::set(Setting^ aSetting) 233 | { 234 | BOOL success = SetMonitorRedGreenOrBlueGain(Handle, MC_GREEN_GAIN, aSetting->Current); 235 | } 236 | 237 | /// 238 | /// 239 | /// 240 | Setting^ PhysicalMonitor::GainBlue::get() 241 | { 242 | DWORD min = 0; 243 | DWORD max = 0; 244 | DWORD current = 0; 245 | // Get our values 246 | BOOL success = GetMonitorRedGreenOrBlueGain(Handle, MC_BLUE_GAIN, &min, ¤t, &max); 247 | // Set our value 248 | iGainBlue.Current = current; 249 | iGainBlue.Min = min; 250 | iGainBlue.Max = max; 251 | // Provide them 252 | return %iGainBlue; 253 | } 254 | 255 | /// 256 | void PhysicalMonitor::GainBlue::set(Setting^ aSetting) 257 | { 258 | BOOL success = SetMonitorRedGreenOrBlueGain(Handle, MC_BLUE_GAIN, aSetting->Current); 259 | } 260 | 261 | /// 262 | /// 263 | /// 264 | Setting^ PhysicalMonitor::DriveRed::get() 265 | { 266 | DWORD min = 0; 267 | DWORD max = 0; 268 | DWORD current = 0; 269 | // Get our values 270 | BOOL success = GetMonitorRedGreenOrBlueDrive(Handle, MC_RED_DRIVE, &min, ¤t, &max); 271 | // Set our value 272 | iGainRed.Current = current; 273 | iGainRed.Min = min; 274 | iGainRed.Max = max; 275 | // Provide them 276 | return %iGainRed; 277 | } 278 | 279 | /// 280 | void PhysicalMonitor::DriveRed::set(Setting^ aSetting) 281 | { 282 | BOOL success = SetMonitorRedGreenOrBlueDrive(Handle, MC_RED_DRIVE, aSetting->Current); 283 | } 284 | 285 | /// 286 | /// 287 | /// 288 | Setting^ PhysicalMonitor::DriveGreen::get() 289 | { 290 | DWORD min = 0; 291 | DWORD max = 0; 292 | DWORD current = 0; 293 | // Get our values 294 | BOOL success = GetMonitorRedGreenOrBlueDrive(Handle, MC_GREEN_DRIVE, &min, ¤t, &max); 295 | // Set our value 296 | iGainGreen.Current = current; 297 | iGainGreen.Min = min; 298 | iGainGreen.Max = max; 299 | // Provide them 300 | return %iGainGreen; 301 | } 302 | 303 | /// 304 | void PhysicalMonitor::DriveGreen::set(Setting^ aSetting) 305 | { 306 | BOOL success = SetMonitorRedGreenOrBlueDrive(Handle, MC_GREEN_DRIVE, aSetting->Current); 307 | } 308 | 309 | /// 310 | /// 311 | /// 312 | Setting^ PhysicalMonitor::DriveBlue::get() 313 | { 314 | DWORD min = 0; 315 | DWORD max = 0; 316 | DWORD current = 0; 317 | // Get our values 318 | BOOL success = GetMonitorRedGreenOrBlueDrive(Handle, MC_BLUE_DRIVE, &min, ¤t, &max); 319 | // Set our value 320 | iGainBlue.Current = current; 321 | iGainBlue.Min = min; 322 | iGainBlue.Max = max; 323 | // Provide them 324 | return %iGainBlue; 325 | } 326 | 327 | /// 328 | void PhysicalMonitor::DriveBlue::set(Setting^ aSetting) 329 | { 330 | BOOL success = SetMonitorRedGreenOrBlueDrive(Handle, MC_BLUE_DRIVE, aSetting->Current); 331 | } 332 | 333 | ////////// Capabilities checks 334 | 335 | bool PhysicalMonitor::SupportsBrightness::get() 336 | { 337 | return (iMonitorCapabilities & MC_CAPS_BRIGHTNESS) != 0; 338 | } 339 | 340 | bool PhysicalMonitor::SupportsContrast::get() 341 | { 342 | return (iMonitorCapabilities & MC_CAPS_CONTRAST) != 0; 343 | } 344 | 345 | bool PhysicalMonitor::SupportsDegauss::get() 346 | { 347 | return (iMonitorCapabilities & MC_CAPS_DEGAUSS) != 0; 348 | } 349 | 350 | bool PhysicalMonitor::SupportsDisplayAreaPosition::get() 351 | { 352 | return (iMonitorCapabilities & MC_CAPS_DISPLAY_AREA_POSITION) != 0; 353 | } 354 | 355 | bool PhysicalMonitor::SupportsDisplayAreaSize::get() 356 | { 357 | return (iMonitorCapabilities & MC_CAPS_DISPLAY_AREA_SIZE) != 0; 358 | } 359 | 360 | bool PhysicalMonitor::SupportsTechnologyType::get() 361 | { 362 | return (iMonitorCapabilities & MC_CAPS_MONITOR_TECHNOLOGY_TYPE) != 0; 363 | } 364 | 365 | bool PhysicalMonitor::SupportsRgbDrive::get() 366 | { 367 | return (iMonitorCapabilities & MC_CAPS_RED_GREEN_BLUE_DRIVE) != 0; 368 | } 369 | 370 | bool PhysicalMonitor::SupportsRgbGain::get() 371 | { 372 | return (iMonitorCapabilities & MC_CAPS_RED_GREEN_BLUE_GAIN) != 0; 373 | } 374 | 375 | bool PhysicalMonitor::SupportsRestoreFactoryDefaults::get() 376 | { 377 | return (iMonitorCapabilities & MC_CAPS_RESTORE_FACTORY_DEFAULTS) != 0; 378 | } 379 | 380 | bool PhysicalMonitor::SupportsRestoreFactoryColorDefaults::get() 381 | { 382 | return (iMonitorCapabilities & MC_CAPS_RESTORE_FACTORY_COLOR_DEFAULTS) != 0; 383 | } 384 | 385 | /// 386 | /// What this means is explaing there: https://msdn.microsoft.com/en-us/library/dd692969(v=vs.85).aspx 387 | /// It's of litle interrests to us. 388 | bool PhysicalMonitor::RestoringFactoryDefaultsEnablesMonitorSettings::get() 389 | { 390 | return (iMonitorCapabilities & MC_RESTORE_FACTORY_DEFAULTS_ENABLES_MONITOR_SETTINGS) != 0; 391 | } 392 | 393 | bool PhysicalMonitor::SupportsColorTemperature::get() 394 | { 395 | return (iMonitorCapabilities & MC_CAPS_COLOR_TEMPERATURE) != 0; 396 | } 397 | 398 | bool PhysicalMonitor::SupportsColorTemperature4000K::get() 399 | { 400 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_4000K) != 0; 401 | } 402 | 403 | bool PhysicalMonitor::SupportsColorTemperature5000K::get() 404 | { 405 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_5000K) != 0; 406 | } 407 | 408 | bool PhysicalMonitor::SupportsColorTemperature6500K::get() 409 | { 410 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_6500K) != 0; 411 | } 412 | 413 | bool PhysicalMonitor::SupportsColorTemperature7500K::get() 414 | { 415 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_7500K) != 0; 416 | } 417 | 418 | bool PhysicalMonitor::SupportsColorTemperature8200K::get() 419 | { 420 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_8200K) != 0; 421 | } 422 | 423 | bool PhysicalMonitor::SupportsColorTemperature9300K::get() 424 | { 425 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_9300K) != 0; 426 | } 427 | 428 | bool PhysicalMonitor::SupportsColorTemperature10000K::get() 429 | { 430 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_10000K) != 0; 431 | } 432 | 433 | bool PhysicalMonitor::SupportsColorTemperature11500K::get() 434 | { 435 | return (iSupportedColorTemperatures & MC_SUPPORTED_COLOR_TEMPERATURE_11500K) != 0; 436 | } 437 | 438 | } 439 | 440 | -------------------------------------------------------------------------------- /Project/Lib/PhysicalMonitor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "Setting.h" 6 | #include "ColorTemperature.h" 7 | 8 | using namespace System; 9 | 10 | 11 | 12 | namespace SharpLib::MonitorConfig 13 | { 14 | 15 | /// 16 | /// 17 | /// 18 | public ref class PhysicalMonitor 19 | { 20 | public: 21 | PhysicalMonitor(PHYSICAL_MONITOR* aData); 22 | ~PhysicalMonitor(); 23 | !PhysicalMonitor(); 24 | 25 | bool Construct(); 26 | 27 | // Actions 28 | void RestoreFactoryDefaults(); 29 | void RestoreFactoryColorDefault(); 30 | 31 | // Type 32 | property String^ TechnologyTypeName 33 | { 34 | String^ get(); 35 | } 36 | 37 | // Capability checks 38 | property bool SupportsBrightness { bool get(); } 39 | property bool SupportsContrast { bool get(); } 40 | property bool SupportsDegauss { bool get(); } 41 | property bool SupportsDisplayAreaPosition { bool get(); } 42 | property bool SupportsDisplayAreaSize { bool get(); } 43 | property bool SupportsTechnologyType { bool get(); } 44 | property bool SupportsRgbDrive { bool get(); } 45 | property bool SupportsRgbGain { bool get(); } 46 | property bool SupportsRestoreFactoryDefaults { bool get(); } 47 | property bool SupportsRestoreFactoryColorDefaults { bool get(); } 48 | property bool RestoringFactoryDefaultsEnablesMonitorSettings { bool get(); } 49 | // Color temperatures 50 | property bool SupportsColorTemperature { bool get(); } 51 | property bool SupportsColorTemperature4000K { bool get(); } 52 | property bool SupportsColorTemperature5000K { bool get(); } 53 | property bool SupportsColorTemperature6500K { bool get(); } 54 | property bool SupportsColorTemperature7500K { bool get(); } 55 | property bool SupportsColorTemperature8200K { bool get(); } 56 | property bool SupportsColorTemperature9300K { bool get(); } 57 | property bool SupportsColorTemperature10000K { bool get(); } 58 | property bool SupportsColorTemperature11500K { bool get(); } 59 | 60 | // Brightness 61 | property Setting^ Brightness 62 | { 63 | Setting^ get(); 64 | void set(Setting^ aSetting); 65 | } 66 | 67 | // Contrast 68 | property Setting^ Contrast 69 | { 70 | Setting^ get(); 71 | void set(Setting^ aSetting); 72 | } 73 | 74 | // Color temperature 75 | property SharpLib::MonitorConfig::ColorTemperature ColorTemperature 76 | { 77 | SharpLib::MonitorConfig::ColorTemperature get(); 78 | void set(SharpLib::MonitorConfig::ColorTemperature aColorTemperature); 79 | } 80 | 81 | // Gain Red 82 | property Setting^ GainRed 83 | { 84 | Setting^ get(); 85 | void set(Setting^ aSetting); 86 | } 87 | 88 | // Gain Green 89 | property Setting^ GainGreen 90 | { 91 | Setting^ get(); 92 | void set(Setting^ aSetting); 93 | } 94 | 95 | // Gain Blue 96 | property Setting^ GainBlue 97 | { 98 | Setting^ get(); 99 | void set(Setting^ aSetting); 100 | } 101 | 102 | // Drive Red 103 | property Setting^ DriveRed 104 | { 105 | Setting^ get(); 106 | void set(Setting^ aSetting); 107 | } 108 | 109 | // Drive Green 110 | property Setting^ DriveGreen 111 | { 112 | Setting^ get(); 113 | void set(Setting^ aSetting); 114 | } 115 | 116 | // Drive Blue 117 | property Setting^ DriveBlue 118 | { 119 | Setting^ get(); 120 | void set(Setting^ aSetting); 121 | } 122 | 123 | 124 | property String^ Description; 125 | 126 | private: 127 | property HANDLE Handle { HANDLE get() { return iData->hPhysicalMonitor; } } 128 | 129 | void GetTechnologyTypeName(); 130 | 131 | private: 132 | PHYSICAL_MONITOR* iData; // Used 133 | DWORD iMonitorCapabilities; 134 | DWORD iSupportedColorTemperatures; 135 | // 136 | Setting iBrightness; 137 | Setting iContrast; 138 | // 139 | Setting iGainRed; 140 | Setting iGainGreen; 141 | Setting iGainBlue; 142 | // 143 | Setting iDriveRed; 144 | Setting iDriveGreen; 145 | Setting iDriveBlue; 146 | // 147 | String^ iTechnologyTypeName; 148 | }; 149 | } 150 | -------------------------------------------------------------------------------- /Project/Lib/Setting.cpp: -------------------------------------------------------------------------------- 1 | #include "setting.h" 2 | 3 | 4 | namespace SharpLib::MonitorConfig 5 | { 6 | 7 | Setting::Setting() 8 | { 9 | Max = 0; 10 | Min = 0; 11 | Current = 0; 12 | } 13 | 14 | Setting::Setting(DWORD aMin, DWORD aCurrent, DWORD aMax) 15 | { 16 | Max = aMin; 17 | Current = aCurrent; 18 | Max = aMax; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /Project/Lib/Setting.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | namespace SharpLib::MonitorConfig 6 | { 7 | /// Define a Monitor Configuration Setting 8 | public ref class Setting 9 | { 10 | public: 11 | Setting(); 12 | Setting(DWORD aMin, DWORD aCurrent, DWORD aMax); 13 | /// Maximum value this setting can take 14 | property DWORD Max; 15 | /// Minimum value this setting can take 16 | property DWORD Min; 17 | /// Current setting value 18 | property DWORD Current; 19 | }; 20 | } -------------------------------------------------------------------------------- /Project/Lib/SharpLibMonitorConfig.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 17.0 23 | true 24 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00} 25 | NetCoreCProj 26 | SharpLibMonitorConfig 27 | 10.0 28 | net8.0 29 | 7.0 30 | SharpLibMonitorConfig 31 | 32 | 33 | 34 | DynamicLibrary 35 | true 36 | v143 37 | NetCore 38 | Unicode 39 | 40 | 41 | DynamicLibrary 42 | false 43 | v143 44 | NetCore 45 | Unicode 46 | 47 | 48 | DynamicLibrary 49 | true 50 | v143 51 | NetCore 52 | Unicode 53 | 54 | 55 | DynamicLibrary 56 | false 57 | v143 58 | NetCore 59 | Unicode 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Level3 83 | _DEBUG;%(PreprocessorDefinitions) 84 | stdcpp20 85 | 86 | 87 | user32.lib;dxva2.lib 88 | 89 | 90 | 91 | 92 | Level3 93 | WIN32;_DEBUG;%(PreprocessorDefinitions) 94 | stdcpp20 95 | 96 | 97 | user32.lib;dxva2.lib 98 | 99 | 100 | 101 | 102 | Level3 103 | WIN32;NDEBUG;%(PreprocessorDefinitions) 104 | stdcpp20 105 | 106 | 107 | user32.lib;dxva2.lib 108 | 109 | 110 | 111 | 112 | Level3 113 | NDEBUG;%(PreprocessorDefinitions) 114 | stdcpp20 115 | 116 | 117 | user32.lib;dxva2.lib 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /Project/Lib/SharpLibMonitorConfig.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /Project/Lib/SharpLibMonitorConfig.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | NativeWithManagedCore 5 | WindowsLocalDebugger 6 | 7 | -------------------------------------------------------------------------------- /Project/Lib/VirtualMonitor.cpp: -------------------------------------------------------------------------------- 1 | #include "VirtualMonitor.h" 2 | 3 | using namespace System::Windows; 4 | 5 | namespace SharpLib::MonitorConfig 6 | { 7 | /** 8 | */ 9 | VirtualMonitor::VirtualMonitor(HMONITOR aHandle, int aIndex) : iHandle(aHandle) 10 | { 11 | iInfo = new MONITORINFOEX(); 12 | iInfo->cbSize = sizeof(MONITORINFOEX); //Need to set this to allow next function to identify Structure type 13 | 14 | if (GetMonitorInfo(aHandle, iInfo) == 0) 15 | { 16 | //TODO: handle error 17 | // Throw exception? 18 | } 19 | 20 | DeviceName = gcnew System::String(iInfo->szDevice); 21 | PhysicalMonitors = gcnew List(); 22 | 23 | /* 24 | DISPLAY_DEVICE displayDevice; 25 | displayDevice.cb = sizeof(DISPLAY_DEVICE); 26 | BOOL res = EnumDisplayDevices(iInfo->szDevice, 0, &displayDevice, 0); 27 | 28 | DEVMODE devMode; 29 | devMode.dmSize = sizeof(DEVMODE); 30 | res = EnumDisplaySettings(iInfo->szDevice, ENUM_CURRENT_SETTINGS, &devMode); 31 | */ 32 | 33 | LoadFriendlyName(aIndex); 34 | 35 | //Build a Rect to be able to get the resolution conveniently 36 | //System::Drawing::Point pt1(iInfo->rcMonitor.left, iInfo->rcMonitor.top); 37 | System::Drawing::Point pt1(0, 0); 38 | System::Drawing::Size pt2(iInfo->rcMonitor.right - iInfo->rcMonitor.left, iInfo->rcMonitor.bottom - iInfo->rcMonitor.top); 39 | Rect = System::Drawing::Rectangle(pt1,pt2); 40 | 41 | // Check how many physical monitor do we have 42 | DWORD count = 0; 43 | GetNumberOfPhysicalMonitorsFromHMONITOR(aHandle, &count); 44 | iPhysicalMonitorCount = count; // Keep track of our count 45 | 46 | // Fetch physical monitors 47 | if (count > 0) //Defensive 48 | { 49 | iPhysicalMonitorArray = new PHYSICAL_MONITOR[count]; 50 | GetPhysicalMonitorsFromHMONITOR(aHandle, count, iPhysicalMonitorArray); 51 | } 52 | 53 | for (DWORD i = 0; iAdd(gcnew PhysicalMonitor(&iPhysicalMonitorArray[i])); 57 | } 58 | 59 | } 60 | 61 | /// Destructor 62 | VirtualMonitor::~VirtualMonitor() 63 | { 64 | // As per Microsoft recommandation we simply call the finalizer from here 65 | // See: https://msdn.microsoft.com/en-us/library/ke3a209d.aspx#Destructors%20and%20finalizers 66 | this->!VirtualMonitor(); 67 | } 68 | 69 | /// Finalizer 70 | VirtualMonitor::!VirtualMonitor() 71 | { 72 | // Taking care of managed resources first, I guess 73 | delete DeviceName; 74 | DeviceName = nullptr; 75 | 76 | // Explicitly destroy our object, me thing that's like Dispose in C# 77 | if (PhysicalMonitors != nullptr) 78 | { 79 | for each (PhysicalMonitor^ m in PhysicalMonitors) 80 | { 81 | delete m; 82 | } 83 | PhysicalMonitors->Clear(); 84 | PhysicalMonitors = nullptr; 85 | } 86 | // As per Microsoft recommandation we clean-up unmanaged resources 87 | delete iInfo; 88 | iInfo = NULL; 89 | 90 | delete iPhysicalMonitorArray; 91 | iPhysicalMonitorArray = NULL; 92 | } 93 | 94 | /** 95 | Tell whether this monitor is our primary monitor. 96 | */ 97 | bool VirtualMonitor::IsPrimary() 98 | { 99 | if (iInfo == NULL) 100 | { 101 | return false; 102 | } 103 | 104 | return (iInfo->dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY; 105 | } 106 | 107 | /// 108 | /// That does not make sense if the monitor is actually virtual but who cares for now 109 | /// I reckon this was taken from there: https://stackoverflow.com/a/28257839/3969362 110 | void VirtualMonitor::LoadFriendlyName(int aIndex) 111 | { 112 | // Set default 113 | FriendlyName = String::Empty; 114 | 115 | UINT32 pathCount = 0; 116 | UINT32 modeCount = 0; 117 | LONG err = GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &pathCount, &modeCount); 118 | if (err != ERROR_SUCCESS) 119 | { 120 | return; 121 | } 122 | 123 | DISPLAYCONFIG_PATH_INFO* displayPaths = new DISPLAYCONFIG_PATH_INFO[pathCount]; 124 | DISPLAYCONFIG_MODE_INFO* displayModes = new DISPLAYCONFIG_MODE_INFO[modeCount]; 125 | 126 | err = QueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &pathCount, displayPaths, &modeCount, displayModes, 0); 127 | if (err != ERROR_SUCCESS) 128 | { 129 | delete displayPaths; 130 | delete displayModes; 131 | return; 132 | } 133 | 134 | int modeTargetCount = 0; 135 | for (UINT32 i = 0; i < modeCount; i++) 136 | { 137 | if (displayModes[i].infoType == DISPLAYCONFIG_MODE_INFO_TYPE_TARGET) 138 | { 139 | if (modeTargetCount == aIndex) // Is that the proper display, clumsy OMG 140 | { 141 | // Now fetch that bloody name 142 | DISPLAYCONFIG_TARGET_DEVICE_NAME deviceName; 143 | deviceName.header.size = sizeof(DISPLAYCONFIG_TARGET_DEVICE_NAME); 144 | deviceName.header.adapterId = displayModes[i].adapterId; 145 | deviceName.header.id = displayModes[i].id; 146 | deviceName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; 147 | err = DisplayConfigGetDeviceInfo(&deviceName.header); 148 | if (err == ERROR_SUCCESS) 149 | { 150 | FriendlyName = gcnew String(deviceName.monitorFriendlyDeviceName); 151 | break; 152 | } 153 | } 154 | modeTargetCount++; 155 | } 156 | } 157 | 158 | // Clean-up 159 | delete displayPaths; 160 | delete displayModes; 161 | } 162 | 163 | 164 | /** 165 | */ 166 | /* 167 | String VirtualMonitor::Name() 168 | { 169 | if (iInfo == NULL) 170 | { 171 | return String::Empty; 172 | } 173 | 174 | 175 | }*/ 176 | } 177 | -------------------------------------------------------------------------------- /Project/Lib/VirtualMonitor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "PhysicalMonitor.h" 4 | 5 | using namespace System; 6 | using namespace System::Windows; 7 | using namespace System::Collections::Generic; 8 | using namespace System::Drawing; 9 | 10 | 11 | namespace SharpLib::MonitorConfig 12 | { 13 | 14 | /// 15 | /// Each VirtualMonitor has a collection of PhysicalMonitor 16 | /// 17 | public ref class VirtualMonitor 18 | { 19 | public: 20 | // Constructor 21 | VirtualMonitor(HMONITOR aHandle, int aIndex); 22 | // Destructor 23 | ~VirtualMonitor(); 24 | // Finalizer 25 | !VirtualMonitor(); 26 | 27 | bool IsPrimary(); 28 | 29 | /// The name of this monitor 30 | property String^ DeviceName; 31 | /// The friendly name of this monitor 32 | property String^ FriendlyName; 33 | /// Rectangle defining our monitor, check its size for monitor resolution 34 | property System::Drawing::Rectangle Rect; 35 | /// A virtual monitor has a collection of physical monitor 36 | property List^ PhysicalMonitors; 37 | 38 | private: 39 | void LoadFriendlyName(int aIndex); 40 | 41 | private: 42 | HMONITOR iHandle; 43 | MONITORINFOEX* iInfo; 44 | DWORD iPhysicalMonitorCount; 45 | PHYSICAL_MONITOR* iPhysicalMonitorArray; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /Project/Lib/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by app.rc 4 | -------------------------------------------------------------------------------- /Project/SharpLibMonitorConfig.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.14.36109.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonitorConfigDemo", "Demo\MonitorConfigDemo.csproj", "{2DFECAE8-5488-4E12-8D17-21BA88C0281E}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SharpLibMonitorConfig", "Lib\SharpLibMonitorConfig.vcxproj", "{C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|x64 = Debug|x64 14 | Debug|x86 = Debug|x86 15 | Release|Any CPU = Release|Any CPU 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Debug|x64.ActiveCfg = Debug|Any CPU 23 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Debug|x64.Build.0 = Debug|Any CPU 24 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Debug|x86.ActiveCfg = Debug|Any CPU 25 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Debug|x86.Build.0 = Debug|Any CPU 26 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Release|x64.ActiveCfg = Release|Any CPU 29 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Release|x64.Build.0 = Release|Any CPU 30 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Release|x86.ActiveCfg = Release|Any CPU 31 | {2DFECAE8-5488-4E12-8D17-21BA88C0281E}.Release|x86.Build.0 = Release|Any CPU 32 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Debug|Any CPU.ActiveCfg = Debug|x64 33 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Debug|Any CPU.Build.0 = Debug|x64 34 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Debug|x64.ActiveCfg = Debug|x64 35 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Debug|x64.Build.0 = Debug|x64 36 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Debug|x86.ActiveCfg = Debug|Win32 37 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Debug|x86.Build.0 = Debug|Win32 38 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Release|Any CPU.ActiveCfg = Release|x64 39 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Release|Any CPU.Build.0 = Release|x64 40 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Release|x64.ActiveCfg = Release|x64 41 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Release|x64.Build.0 = Release|x64 42 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Release|x86.ActiveCfg = Release|Win32 43 | {C020A2D6-6363-C7BE-FA35-D5D0B96ECD00}.Release|x86.Build.0 = Release|Win32 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | GlobalSection(ExtensibilityGlobals) = postSolution 49 | SolutionGuid = {AAE09130-A3E8-4E19-9943-4E4687271507} 50 | EndGlobalSection 51 | EndGlobal 52 | -------------------------------------------------------------------------------- /Publish/MonitorConfigDemo.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | MonitorConfigDemo 8 | $version$ 9 | Monitor Configuration Demo 10 | Stephane Lenclud 11 | http://publish.slions.net/MonitorConfigDemo/favicon.ico 12 | false 13 | Windows Monitor Configuration Demo for DDC/CI monitors. 14 | Copyright (c) 2017, Stephane Lenclud 15 | en-US 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 | -------------------------------------------------------------------------------- /Publish/SharpLibMonitorConfig.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | SharpLibMonitorConfig 5 | 1.0.0 6 | Windows Monitor Configuration Library 7 | Stéphane Lenclud 8 | Stéphane Lenclud 9 | http://www.gnu.org/copyleft/gpl.html 10 | https://github.com/Slion/SharpLibMonitorConfig 11 | false 12 | CLR Class Library providing access to Windows Monitor Configuration. Most convenient to adjust monitor settings such as brightness and contrast. 13 | Initial release. 14 | Stéphane Lenclud 15 | 16 | Monitor Configuration Display DDC 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Build Status](https://slions.visualstudio.com/_apis/public/build/definitions/ad16bbd0-a884-4787-8e3a-85daf30cca16/1/badge) 2 | 3 | # Windows Monitor Configuration library 4 | A .NET library providing [Windows Monitor Configuration] functionalities to .NET applications. 5 | Written in C++/CLI to conveniently leverage Win32 APIs without dealing with [Platform Invocation Services]. 6 | 7 | [Windows Monitor Configuration] enables applications to adjust a monitor settings such as brightness, contrast and colors. 8 | It should work with any monitor compatible with [Display Data Channel (DDC/CI)] standards. 9 | 10 | # Monitor Configuration Demo 11 | A .NET C# application making use of the above library. 12 | 13 | # Downloads 14 | Please visist the [Monitor Configuration Demo] home page. 15 | 16 | [Windows Monitor Configuration]: https://msdn.microsoft.com/en-us/library/vs/alm/dd692962(v=vs.85).aspx 17 | [Platform Invocation Services]: https://en.wikipedia.org/wiki/Platform_Invocation_Services 18 | [Display Data Channel (DDC/CI)]: https://en.wikipedia.org/wiki/Display_Data_Channel 19 | [Monitor Configuration Demo]: https://slions.net/resources/monitor-configuration-demo.3/ 20 | 21 | # Library 22 | 23 | The provided library is a CLR Class Library (.NET). 24 | It's using C++/CLI to provide .NET application access to monitor configuration. 25 | 26 | # Resources 27 | 28 | - [Compile C++/CLI] 29 | - [Port C++/CLI] 30 | - [.NET with C++/CLI] 31 | - Get monitor name, see [1] or [2] 32 | 33 | [Compile C++/CLI]: https://learn.microsoft.com/en-us/cpp/dotnet/walkthrough-compiling-a-cpp-program-that-targets-the-clr-in-visual-studio?view=msvc-170 34 | [Port C++/CLI]: https://learn.microsoft.com/en-us/dotnet/core/porting/cpp-cli 35 | [.NET with C++/CLI]: https://learn.microsoft.com/en-us/cpp/dotnet/dotnet-programming-with-cpp-cli-visual-cpp 36 | [1]: https://stackoverflow.com/a/28257839/3969362 37 | [2]: https://stackoverflow.com/questions/20060584/get-the-name-of-a-monitor --------------------------------------------------------------------------------