mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-26 12:27:06 +00:00
Moved color picker code to Vendor folder and Updated README
This commit is contained in:
@@ -171,31 +171,6 @@
|
||||
<Compile Include="Classes\API\PCKCenter\PCKCollectionsLocal.cs" />
|
||||
<Compile Include="Classes\API\PCKCenter\SaveLocalJSON.cs" />
|
||||
<Compile Include="Classes\Extentions\EnumerableExtentions.cs" />
|
||||
<Compile Include="Classes\COL\ColorChangedEventArgs.cs" />
|
||||
<Compile Include="Classes\COL\ColorModes.cs" />
|
||||
<Compile Include="Classes\COL\Controls\ColorBox2D.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\Controls\ColorBox2D.Designer.cs">
|
||||
<DependentUpon>ColorBox2D.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\Controls\ColorHexagon.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\Controls\ColorHexagon.Designer.cs">
|
||||
<DependentUpon>ColorHexagon.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\Controls\ColorSliderVertical.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\Controls\ColorSliderVertical.Designer.cs">
|
||||
<DependentUpon>ColorSliderVertical.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\Controls\ColorWheel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Classes\COL\HslColor.cs" />
|
||||
<Compile Include="Classes\COL\MathExtensions.cs" />
|
||||
<Compile Include="Classes\FileTypes\CSMBFile.cs" />
|
||||
<Compile Include="Classes\FileTypes\PCKAudioFile.cs" />
|
||||
<Compile Include="Classes\FileTypes\Binka.cs" />
|
||||
@@ -508,9 +483,6 @@
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\EntityForms\AddEntry.resx">
|
||||
<DependentUpon>AddEntry.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Classes\COL\Controls\ColorSliderVertical.resx">
|
||||
<DependentUpon>ColorSliderVertical.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\AboutThisProgram.resx">
|
||||
<DependentUpon>AboutThisProgram.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -813,6 +785,10 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Vendor\MechanikaDesign\ColorBox2D\ColorPicker.csproj">
|
||||
<Project>{38f99682-d013-4ae3-8334-4bf492a11ff9}</Project>
|
||||
<Name>ColorPicker</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Vendor\OMI-Lib\OMI Filetypes Library\OMI Filetype Library.csproj">
|
||||
<Project>{693AEBC1-293D-4DF0-BCAE-26A1099FE7BB}</Project>
|
||||
<Name>OMI Filetype Library</Name>
|
||||
|
||||
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OMI Filetype Library", "Ven
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Net Framework v4.8", "Vendor\CrEaTiiOn-Brotherhood-Official-C-Theme\Net_Framework_v4.8\Net Framework v4.8.csproj", "{C3D7B16C-C047-4BAA-884F-7A2308619C33}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "Vendor\MechanikaDesign\ColorBox2D\ColorPicker.csproj", "{38F99682-D013-4AE3-8334-4BF492A11FF9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -78,6 +80,24 @@ Global
|
||||
{C3D7B16C-C047-4BAA-884F-7A2308619C33}.ReleasePortable|x64.Build.0 = Release|Any CPU
|
||||
{C3D7B16C-C047-4BAA-884F-7A2308619C33}.ReleasePortable|x86.ActiveCfg = Release|Any CPU
|
||||
{C3D7B16C-C047-4BAA-884F-7A2308619C33}.ReleasePortable|x86.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|x86.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.ReleasePortable|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.ReleasePortable|Any CPU.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.ReleasePortable|x64.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.ReleasePortable|x64.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.ReleasePortable|x86.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.ReleasePortable|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -85,6 +105,7 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{693AEBC1-293D-4DF0-BCAE-26A1099FE7BB} = {FC87F3E5-B07E-4FFB-889F-66FA3A3CFCAA}
|
||||
{C3D7B16C-C047-4BAA-884F-7A2308619C33} = {FC87F3E5-B07E-4FFB-889F-66FA3A3CFCAA}
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9} = {FC87F3E5-B07E-4FFB-889F-66FA3A3CFCAA}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9A3BF1FB-950F-401E-9F58-EA7BBADCE6F2}
|
||||
|
||||
@@ -7,7 +7,7 @@ Modify .PCK archives as you please!
|
||||
* Add / Remove / Replace skins, audios, textures, animations and much more.
|
||||
* Edit localization data to make your mods support every language supported by minecraft itself!
|
||||
* PNG previewing
|
||||
* And much more!\
|
||||
* And much more!
|
||||
|
||||
## Supported File formats
|
||||
|
||||
@@ -47,6 +47,11 @@ $ cd "-PCK-Studio"
|
||||
|
||||
* Forms will not load in viewer until the solution is build _at least_ once
|
||||
|
||||
## Dependencies
|
||||
> [OMI-Filetype-Library](https://github.com/PhoenixARC/-OMI-Filetype-Library) for Minecraft filetype handling.<br>
|
||||
> [CrEaTiiOn-Brotherhood-Official-C-Theme](https://github.com/EternalModz/CrEaTiiOn-Brotherhood-Official-C-Theme) for better User Interface.<br>
|
||||
> [MechanikaDesign.WinForms.UI.ColorPicker](https://www.mechanikadesign.com/software/colorpicker-controls-for-windows-forms/) for better color picking.<br>
|
||||
|
||||
|
||||
## Active Dev Team:
|
||||
* [PhoenixARC](https://github.com/PhoenixARC)
|
||||
|
||||
88
Vendor/MechanikaDesign/ColorBox2D/ColorPicker.csproj
vendored
Normal file
88
Vendor/MechanikaDesign/ColorBox2D/ColorPicker.csproj
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{38F99682-D013-4AE3-8334-4BF492A11FF9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MechanikaDesign.WinForms.UI.ColorPicker</RootNamespace>
|
||||
<AssemblyName>ColorPicker</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controls\ColorBox2D.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ColorBox2D.Designer.cs">
|
||||
<DependentUpon>ColorBox2D.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ColorChangedEventArgs.cs" />
|
||||
<Compile Include="Controls\ColorHexagon.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ColorHexagon.Designer.cs">
|
||||
<DependentUpon>ColorHexagon.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ColorModes.cs" />
|
||||
<Compile Include="Controls\ColorSliderVertical.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ColorSliderVertical.Designer.cs">
|
||||
<DependentUpon>ColorSliderVertical.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ColorWheel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="HslColor.cs" />
|
||||
<Compile Include="MathExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Controls\ColorSliderVertical.resx">
|
||||
<DependentUpon>ColorSliderVertical.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
36
Vendor/MechanikaDesign/ColorBox2D/Properties/AssemblyInfo.cs
vendored
Normal file
36
Vendor/MechanikaDesign/ColorBox2D/Properties/AssemblyInfo.cs
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Mechanika Design Color Picker Controls")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Mechanika Design Color Picker Controls Library")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 Mechanika Design")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("53782a11-f0b6-4d1f-8365-2078a4133dfa")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
Vendor/MechanikaDesign/ColorHexagon/ColorHexagon.csproj
vendored
Normal file
63
Vendor/MechanikaDesign/ColorHexagon/ColorHexagon.csproj
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{ADC128AF-95A4-4BA9-B5D7-FE438E1E7A5C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ColorHexagon</RootNamespace>
|
||||
<AssemblyName>ColorHexagon</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ColorHexagon.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ColorHexagon.Designer.cs">
|
||||
<DependentUpon>ColorHexagon.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="HslColor.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
36
Vendor/MechanikaDesign/ColorHexagon/Properties/AssemblyInfo.cs
vendored
Normal file
36
Vendor/MechanikaDesign/ColorHexagon/Properties/AssemblyInfo.cs
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ColorHexagon")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ColorHexagon")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d53138c7-6021-4516-ada2-197f71459161")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
6
Vendor/MechanikaDesign/ColorPicker.Demo/App.config
vendored
Normal file
6
Vendor/MechanikaDesign/ColorPicker.Demo/App.config
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
99
Vendor/MechanikaDesign/ColorPicker.Demo/ColorPicker.Demo.csproj
vendored
Normal file
99
Vendor/MechanikaDesign/ColorPicker.Demo/ColorPicker.Demo.csproj
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DF274AA1-5380-4B84-B9F5-FF66E6A1D37B}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ColorPicker.Demo</RootNamespace>
|
||||
<AssemblyName>ColorPicker.Demo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Telerik.WinControls, Version=2015.1.331.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
|
||||
<Reference Include="TelerikCommon, Version=2015.1.331.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FormColorPickerDemo.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormColorPickerDemo.Designer.cs">
|
||||
<DependentUpon>FormColorPickerDemo.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FormColorPickerDemo.resx">
|
||||
<DependentUpon>FormColorPickerDemo.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ColorBox2D\ColorPicker.csproj">
|
||||
<Project>{38F99682-D013-4AE3-8334-4BF492A11FF9}</Project>
|
||||
<Name>ColorPicker</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
412
Vendor/MechanikaDesign/ColorPicker.Demo/FormColorPickerDemo.Designer.cs
generated
vendored
Normal file
412
Vendor/MechanikaDesign/ColorPicker.Demo/FormColorPickerDemo.Designer.cs
generated
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
namespace ColorHexagon.Demo
|
||||
{
|
||||
partial class FormColorPickerDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelCurrent = new System.Windows.Forms.Label();
|
||||
this.labelCurrentColor = new System.Windows.Forms.Label();
|
||||
this.labelHex = new System.Windows.Forms.Label();
|
||||
this.textboxHexColor = new System.Windows.Forms.TextBox();
|
||||
this.tabControlMain = new System.Windows.Forms.TabControl();
|
||||
this.tabHexagon = new System.Windows.Forms.TabPage();
|
||||
this.colorHexagon = new MechanikaDesign.WinForms.UI.ColorPicker.ColorHexagon();
|
||||
this.tabWheel = new System.Windows.Forms.TabPage();
|
||||
this.colorWheel = new MechanikaDesign.WinForms.UI.ColorPicker.ColorWheel();
|
||||
this.tabColorBox = new System.Windows.Forms.TabPage();
|
||||
this.numLuminance = new System.Windows.Forms.NumericUpDown();
|
||||
this.radioLuminance = new System.Windows.Forms.RadioButton();
|
||||
this.numSaturation = new System.Windows.Forms.NumericUpDown();
|
||||
this.radioSaturation = new System.Windows.Forms.RadioButton();
|
||||
this.numHue = new System.Windows.Forms.NumericUpDown();
|
||||
this.radioHue = new System.Windows.Forms.RadioButton();
|
||||
this.numBlue = new System.Windows.Forms.NumericUpDown();
|
||||
this.radioBlue = new System.Windows.Forms.RadioButton();
|
||||
this.numGreen = new System.Windows.Forms.NumericUpDown();
|
||||
this.radioGreen = new System.Windows.Forms.RadioButton();
|
||||
this.numRed = new System.Windows.Forms.NumericUpDown();
|
||||
this.radioRed = new System.Windows.Forms.RadioButton();
|
||||
this.colorSlider = new MechanikaDesign.WinForms.UI.ColorPicker.ColorSliderVertical();
|
||||
this.colorBox2D = new MechanikaDesign.WinForms.UI.ColorPicker.ColorBox2D();
|
||||
this.tabControlMain.SuspendLayout();
|
||||
this.tabHexagon.SuspendLayout();
|
||||
this.tabWheel.SuspendLayout();
|
||||
this.tabColorBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numLuminance)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numSaturation)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numHue)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numBlue)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numGreen)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numRed)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelCurrent
|
||||
//
|
||||
this.labelCurrent.AutoSize = true;
|
||||
this.labelCurrent.Location = new System.Drawing.Point(448, 22);
|
||||
this.labelCurrent.Name = "labelCurrent";
|
||||
this.labelCurrent.Size = new System.Drawing.Size(41, 13);
|
||||
this.labelCurrent.TabIndex = 1;
|
||||
this.labelCurrent.Text = "Current";
|
||||
//
|
||||
// labelCurrentColor
|
||||
//
|
||||
this.labelCurrentColor.BackColor = System.Drawing.Color.White;
|
||||
this.labelCurrentColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelCurrentColor.Location = new System.Drawing.Point(451, 39);
|
||||
this.labelCurrentColor.Name = "labelCurrentColor";
|
||||
this.labelCurrentColor.Size = new System.Drawing.Size(68, 32);
|
||||
this.labelCurrentColor.TabIndex = 2;
|
||||
//
|
||||
// labelHex
|
||||
//
|
||||
this.labelHex.AutoSize = true;
|
||||
this.labelHex.Location = new System.Drawing.Point(448, 98);
|
||||
this.labelHex.Name = "labelHex";
|
||||
this.labelHex.Size = new System.Drawing.Size(26, 13);
|
||||
this.labelHex.TabIndex = 3;
|
||||
this.labelHex.Text = "Hex";
|
||||
//
|
||||
// textboxHexColor
|
||||
//
|
||||
this.textboxHexColor.Location = new System.Drawing.Point(451, 114);
|
||||
this.textboxHexColor.Name = "textboxHexColor";
|
||||
this.textboxHexColor.ReadOnly = true;
|
||||
this.textboxHexColor.Size = new System.Drawing.Size(68, 20);
|
||||
this.textboxHexColor.TabIndex = 4;
|
||||
this.textboxHexColor.Text = "FFFFFF";
|
||||
//
|
||||
// tabControlMain
|
||||
//
|
||||
this.tabControlMain.Controls.Add(this.tabHexagon);
|
||||
this.tabControlMain.Controls.Add(this.tabWheel);
|
||||
this.tabControlMain.Controls.Add(this.tabColorBox);
|
||||
this.tabControlMain.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.tabControlMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControlMain.Name = "tabControlMain";
|
||||
this.tabControlMain.SelectedIndex = 0;
|
||||
this.tabControlMain.Size = new System.Drawing.Size(427, 370);
|
||||
this.tabControlMain.TabIndex = 5;
|
||||
//
|
||||
// tabHexagon
|
||||
//
|
||||
this.tabHexagon.Controls.Add(this.colorHexagon);
|
||||
this.tabHexagon.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabHexagon.Name = "tabHexagon";
|
||||
this.tabHexagon.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabHexagon.Size = new System.Drawing.Size(419, 344);
|
||||
this.tabHexagon.TabIndex = 0;
|
||||
this.tabHexagon.Text = "Color Hexagon";
|
||||
this.tabHexagon.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// colorHexagon
|
||||
//
|
||||
this.colorHexagon.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.colorHexagon.Location = new System.Drawing.Point(3, 3);
|
||||
this.colorHexagon.Name = "colorHexagon";
|
||||
this.colorHexagon.Size = new System.Drawing.Size(413, 338);
|
||||
this.colorHexagon.TabIndex = 1;
|
||||
this.colorHexagon.ColorChanged += new MechanikaDesign.WinForms.UI.ColorPicker.ColorHexagon.ColorChangedEventHandler(this.colorHexagon_ColorChanged);
|
||||
//
|
||||
// tabWheel
|
||||
//
|
||||
this.tabWheel.Controls.Add(this.colorWheel);
|
||||
this.tabWheel.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabWheel.Name = "tabWheel";
|
||||
this.tabWheel.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabWheel.Size = new System.Drawing.Size(419, 344);
|
||||
this.tabWheel.TabIndex = 1;
|
||||
this.tabWheel.Text = "Color Wheel";
|
||||
this.tabWheel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// colorWheel
|
||||
//
|
||||
this.colorWheel.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.colorWheel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.colorWheel.Location = new System.Drawing.Point(3, 3);
|
||||
this.colorWheel.Name = "colorWheel";
|
||||
this.colorWheel.Size = new System.Drawing.Size(413, 338);
|
||||
this.colorWheel.TabIndex = 0;
|
||||
this.colorWheel.ColorChanged += new System.EventHandler(this.colorWheel_ColorChanged);
|
||||
//
|
||||
// tabColorBox
|
||||
//
|
||||
this.tabColorBox.Controls.Add(this.numLuminance);
|
||||
this.tabColorBox.Controls.Add(this.radioLuminance);
|
||||
this.tabColorBox.Controls.Add(this.numSaturation);
|
||||
this.tabColorBox.Controls.Add(this.radioSaturation);
|
||||
this.tabColorBox.Controls.Add(this.numHue);
|
||||
this.tabColorBox.Controls.Add(this.radioHue);
|
||||
this.tabColorBox.Controls.Add(this.numBlue);
|
||||
this.tabColorBox.Controls.Add(this.radioBlue);
|
||||
this.tabColorBox.Controls.Add(this.numGreen);
|
||||
this.tabColorBox.Controls.Add(this.radioGreen);
|
||||
this.tabColorBox.Controls.Add(this.numRed);
|
||||
this.tabColorBox.Controls.Add(this.radioRed);
|
||||
this.tabColorBox.Controls.Add(this.colorSlider);
|
||||
this.tabColorBox.Controls.Add(this.colorBox2D);
|
||||
this.tabColorBox.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabColorBox.Name = "tabColorBox";
|
||||
this.tabColorBox.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabColorBox.Size = new System.Drawing.Size(419, 344);
|
||||
this.tabColorBox.TabIndex = 2;
|
||||
this.tabColorBox.Text = "Color Box & Slider";
|
||||
this.tabColorBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numLuminance
|
||||
//
|
||||
this.numLuminance.Location = new System.Drawing.Point(349, 165);
|
||||
this.numLuminance.Name = "numLuminance";
|
||||
this.numLuminance.Size = new System.Drawing.Size(54, 20);
|
||||
this.numLuminance.TabIndex = 13;
|
||||
this.numLuminance.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numLuminance.ValueChanged += new System.EventHandler(this.numLuminance_ValueChanged);
|
||||
//
|
||||
// radioLuminance
|
||||
//
|
||||
this.radioLuminance.AutoSize = true;
|
||||
this.radioLuminance.Location = new System.Drawing.Point(306, 165);
|
||||
this.radioLuminance.Name = "radioLuminance";
|
||||
this.radioLuminance.Size = new System.Drawing.Size(34, 17);
|
||||
this.radioLuminance.TabIndex = 12;
|
||||
this.radioLuminance.Text = "L:";
|
||||
this.radioLuminance.UseVisualStyleBackColor = true;
|
||||
this.radioLuminance.CheckedChanged += new System.EventHandler(this.ColorModeChangedHandler);
|
||||
//
|
||||
// numSaturation
|
||||
//
|
||||
this.numSaturation.Location = new System.Drawing.Point(349, 139);
|
||||
this.numSaturation.Name = "numSaturation";
|
||||
this.numSaturation.Size = new System.Drawing.Size(54, 20);
|
||||
this.numSaturation.TabIndex = 11;
|
||||
this.numSaturation.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numSaturation.ValueChanged += new System.EventHandler(this.numSaturation_ValueChanged);
|
||||
//
|
||||
// radioSaturation
|
||||
//
|
||||
this.radioSaturation.AutoSize = true;
|
||||
this.radioSaturation.Location = new System.Drawing.Point(306, 139);
|
||||
this.radioSaturation.Name = "radioSaturation";
|
||||
this.radioSaturation.Size = new System.Drawing.Size(35, 17);
|
||||
this.radioSaturation.TabIndex = 10;
|
||||
this.radioSaturation.Text = "S:";
|
||||
this.radioSaturation.UseVisualStyleBackColor = true;
|
||||
this.radioSaturation.CheckedChanged += new System.EventHandler(this.ColorModeChangedHandler);
|
||||
//
|
||||
// numHue
|
||||
//
|
||||
this.numHue.Location = new System.Drawing.Point(349, 113);
|
||||
this.numHue.Maximum = new decimal(new int[] {
|
||||
359,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numHue.Name = "numHue";
|
||||
this.numHue.Size = new System.Drawing.Size(54, 20);
|
||||
this.numHue.TabIndex = 9;
|
||||
this.numHue.ValueChanged += new System.EventHandler(this.numHue_ValueChanged);
|
||||
//
|
||||
// radioHue
|
||||
//
|
||||
this.radioHue.AutoSize = true;
|
||||
this.radioHue.Checked = true;
|
||||
this.radioHue.Location = new System.Drawing.Point(306, 113);
|
||||
this.radioHue.Name = "radioHue";
|
||||
this.radioHue.Size = new System.Drawing.Size(36, 17);
|
||||
this.radioHue.TabIndex = 8;
|
||||
this.radioHue.TabStop = true;
|
||||
this.radioHue.Text = "H:";
|
||||
this.radioHue.UseVisualStyleBackColor = true;
|
||||
this.radioHue.CheckedChanged += new System.EventHandler(this.ColorModeChangedHandler);
|
||||
//
|
||||
// numBlue
|
||||
//
|
||||
this.numBlue.Location = new System.Drawing.Point(349, 69);
|
||||
this.numBlue.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numBlue.Name = "numBlue";
|
||||
this.numBlue.Size = new System.Drawing.Size(54, 20);
|
||||
this.numBlue.TabIndex = 7;
|
||||
this.numBlue.ValueChanged += new System.EventHandler(this.numBlue_ValueChanged);
|
||||
//
|
||||
// radioBlue
|
||||
//
|
||||
this.radioBlue.AutoSize = true;
|
||||
this.radioBlue.Location = new System.Drawing.Point(306, 69);
|
||||
this.radioBlue.Name = "radioBlue";
|
||||
this.radioBlue.Size = new System.Drawing.Size(35, 17);
|
||||
this.radioBlue.TabIndex = 6;
|
||||
this.radioBlue.Text = "B:";
|
||||
this.radioBlue.UseVisualStyleBackColor = true;
|
||||
this.radioBlue.CheckedChanged += new System.EventHandler(this.ColorModeChangedHandler);
|
||||
//
|
||||
// numGreen
|
||||
//
|
||||
this.numGreen.Location = new System.Drawing.Point(349, 43);
|
||||
this.numGreen.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numGreen.Name = "numGreen";
|
||||
this.numGreen.Size = new System.Drawing.Size(54, 20);
|
||||
this.numGreen.TabIndex = 5;
|
||||
this.numGreen.ValueChanged += new System.EventHandler(this.numGreen_ValueChanged);
|
||||
//
|
||||
// radioGreen
|
||||
//
|
||||
this.radioGreen.AutoSize = true;
|
||||
this.radioGreen.Location = new System.Drawing.Point(306, 43);
|
||||
this.radioGreen.Name = "radioGreen";
|
||||
this.radioGreen.Size = new System.Drawing.Size(36, 17);
|
||||
this.radioGreen.TabIndex = 4;
|
||||
this.radioGreen.Text = "G:";
|
||||
this.radioGreen.UseVisualStyleBackColor = true;
|
||||
this.radioGreen.CheckedChanged += new System.EventHandler(this.ColorModeChangedHandler);
|
||||
//
|
||||
// numRed
|
||||
//
|
||||
this.numRed.Location = new System.Drawing.Point(349, 17);
|
||||
this.numRed.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numRed.Name = "numRed";
|
||||
this.numRed.Size = new System.Drawing.Size(54, 20);
|
||||
this.numRed.TabIndex = 3;
|
||||
this.numRed.Value = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numRed.ValueChanged += new System.EventHandler(this.numRed_ValueChanged);
|
||||
//
|
||||
// radioRed
|
||||
//
|
||||
this.radioRed.AutoSize = true;
|
||||
this.radioRed.Location = new System.Drawing.Point(306, 17);
|
||||
this.radioRed.Name = "radioRed";
|
||||
this.radioRed.Size = new System.Drawing.Size(36, 17);
|
||||
this.radioRed.TabIndex = 2;
|
||||
this.radioRed.Text = "R:";
|
||||
this.radioRed.UseVisualStyleBackColor = true;
|
||||
this.radioRed.CheckedChanged += new System.EventHandler(this.ColorModeChangedHandler);
|
||||
//
|
||||
// colorSlider
|
||||
//
|
||||
this.colorSlider.ColorMode = MechanikaDesign.WinForms.UI.ColorPicker.ColorModes.Hue;
|
||||
this.colorSlider.ColorRGB = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
|
||||
this.colorSlider.Location = new System.Drawing.Point(259, 8);
|
||||
this.colorSlider.Name = "colorSlider";
|
||||
this.colorSlider.NubColor = System.Drawing.Color.White;
|
||||
this.colorSlider.Position = 142;
|
||||
this.colorSlider.Size = new System.Drawing.Size(40, 252);
|
||||
this.colorSlider.TabIndex = 1;
|
||||
this.colorSlider.ColorChanged += new MechanikaDesign.WinForms.UI.ColorPicker.ColorSliderVertical.ColorChangedEventHandler(this.colorSlider_ColorChanged);
|
||||
//
|
||||
// colorBox2D
|
||||
//
|
||||
this.colorBox2D.ColorMode = MechanikaDesign.WinForms.UI.ColorPicker.ColorModes.Hue;
|
||||
this.colorBox2D.ColorRGB = System.Drawing.Color.Red;
|
||||
this.colorBox2D.Location = new System.Drawing.Point(8, 8);
|
||||
this.colorBox2D.Name = "colorBox2D";
|
||||
this.colorBox2D.Size = new System.Drawing.Size(245, 252);
|
||||
this.colorBox2D.TabIndex = 0;
|
||||
this.colorBox2D.ColorChanged += new MechanikaDesign.WinForms.UI.ColorPicker.ColorBox2D.ColorChangedEventHandler(this.colorBox2D_ColorChanged);
|
||||
//
|
||||
// FormColorPickerDemo
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(535, 370);
|
||||
this.Controls.Add(this.tabControlMain);
|
||||
this.Controls.Add(this.textboxHexColor);
|
||||
this.Controls.Add(this.labelHex);
|
||||
this.Controls.Add(this.labelCurrentColor);
|
||||
this.Controls.Add(this.labelCurrent);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "FormColorPickerDemo";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Color Picker UI Control Demo";
|
||||
this.tabControlMain.ResumeLayout(false);
|
||||
this.tabHexagon.ResumeLayout(false);
|
||||
this.tabWheel.ResumeLayout(false);
|
||||
this.tabColorBox.ResumeLayout(false);
|
||||
this.tabColorBox.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numLuminance)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numSaturation)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numHue)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numBlue)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numGreen)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numRed)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label labelCurrent;
|
||||
private System.Windows.Forms.Label labelCurrentColor;
|
||||
private System.Windows.Forms.Label labelHex;
|
||||
private System.Windows.Forms.TextBox textboxHexColor;
|
||||
private System.Windows.Forms.TabControl tabControlMain;
|
||||
private System.Windows.Forms.TabPage tabHexagon;
|
||||
private MechanikaDesign.WinForms.UI.ColorPicker.ColorHexagon colorHexagon;
|
||||
private System.Windows.Forms.TabPage tabWheel;
|
||||
private MechanikaDesign.WinForms.UI.ColorPicker.ColorWheel colorWheel;
|
||||
private System.Windows.Forms.TabPage tabColorBox;
|
||||
private MechanikaDesign.WinForms.UI.ColorPicker.ColorBox2D colorBox2D;
|
||||
private MechanikaDesign.WinForms.UI.ColorPicker.ColorSliderVertical colorSlider;
|
||||
private System.Windows.Forms.NumericUpDown numBlue;
|
||||
private System.Windows.Forms.RadioButton radioBlue;
|
||||
private System.Windows.Forms.NumericUpDown numGreen;
|
||||
private System.Windows.Forms.RadioButton radioGreen;
|
||||
private System.Windows.Forms.NumericUpDown numRed;
|
||||
private System.Windows.Forms.RadioButton radioRed;
|
||||
private System.Windows.Forms.NumericUpDown numLuminance;
|
||||
private System.Windows.Forms.RadioButton radioLuminance;
|
||||
private System.Windows.Forms.NumericUpDown numSaturation;
|
||||
private System.Windows.Forms.RadioButton radioSaturation;
|
||||
private System.Windows.Forms.NumericUpDown numHue;
|
||||
private System.Windows.Forms.RadioButton radioHue;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
196
Vendor/MechanikaDesign/ColorPicker.Demo/FormColorPickerDemo.cs
vendored
Normal file
196
Vendor/MechanikaDesign/ColorPicker.Demo/FormColorPickerDemo.cs
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using MechanikaDesign.WinForms.UI.ColorPicker;
|
||||
|
||||
namespace ColorHexagon.Demo
|
||||
{
|
||||
public partial class FormColorPickerDemo : Form
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private HslColor colorHsl = HslColor.FromAhsl(0xff);
|
||||
private ColorModes colorMode = ColorModes.Hue;
|
||||
private Color colorRgb = Color.Empty;
|
||||
private bool lockUpdates = false;
|
||||
|
||||
#endregion
|
||||
|
||||
public FormColorPickerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.colorBox2D.ColorMode = this.colorMode;
|
||||
this.colorSlider.ColorMode = this.colorMode;
|
||||
}
|
||||
|
||||
private void colorHexagon_ColorChanged(object sender, ColorChangedEventArgs args)
|
||||
{
|
||||
labelCurrentColor.BackColor = colorHexagon.SelectedColor;
|
||||
textboxHexColor.Text = ColorTranslator.ToHtml(colorHexagon.SelectedColor);
|
||||
}
|
||||
|
||||
private void colorWheel_ColorChanged(object sender, EventArgs e)
|
||||
{
|
||||
labelCurrentColor.BackColor = colorWheel.Color;
|
||||
textboxHexColor.Text = ColorTranslator.ToHtml(colorWheel.Color);
|
||||
}
|
||||
|
||||
private void colorSlider_ColorChanged(object sender, ColorChangedEventArgs args)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
HslColor colorHSL = this.colorSlider.ColorHSL;
|
||||
this.colorHsl = colorHSL;
|
||||
this.colorRgb = this.colorHsl.RgbValue;
|
||||
this.lockUpdates = true;
|
||||
this.colorBox2D.ColorHSL = this.colorHsl;
|
||||
this.lockUpdates = false;
|
||||
labelCurrentColor.BackColor = this.colorRgb;
|
||||
textboxHexColor.Text = ColorTranslator.ToHtml(this.colorRgb);
|
||||
UpdateColorFields();
|
||||
}
|
||||
}
|
||||
|
||||
private void colorBox2D_ColorChanged(object sender, ColorChangedEventArgs args)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
HslColor colorHSL = this.colorBox2D.ColorHSL;
|
||||
this.colorHsl = colorHSL;
|
||||
this.colorRgb = this.colorHsl.RgbValue;
|
||||
this.lockUpdates = true;
|
||||
this.colorSlider.ColorHSL = this.colorHsl;
|
||||
this.lockUpdates = false;
|
||||
labelCurrentColor.BackColor = this.colorRgb;
|
||||
textboxHexColor.Text = ColorTranslator.ToHtml(this.colorRgb);
|
||||
UpdateColorFields();
|
||||
}
|
||||
}
|
||||
|
||||
private void ColorModeChangedHandler(object sender, EventArgs e)
|
||||
{
|
||||
if (sender == this.radioRed)
|
||||
{
|
||||
this.colorMode = ColorModes.Red;
|
||||
}
|
||||
else if (sender == this.radioGreen)
|
||||
{
|
||||
this.colorMode = ColorModes.Green;
|
||||
}
|
||||
else if (sender == this.radioBlue)
|
||||
{
|
||||
this.colorMode = ColorModes.Blue;
|
||||
}
|
||||
else if (sender == this.radioHue)
|
||||
{
|
||||
this.colorMode = ColorModes.Hue;
|
||||
}
|
||||
else if (sender == this.radioSaturation)
|
||||
{
|
||||
this.colorMode = ColorModes.Saturation;
|
||||
}
|
||||
else if (sender == this.radioLuminance)
|
||||
{
|
||||
this.colorMode = ColorModes.Luminance;
|
||||
}
|
||||
this.colorSlider.ColorMode = this.colorMode;
|
||||
this.colorBox2D.ColorMode = this.colorMode;
|
||||
}
|
||||
|
||||
private void UpdateColorFields()
|
||||
{
|
||||
this.lockUpdates = true;
|
||||
this.numRed.Value = this.colorRgb.R;
|
||||
this.numGreen.Value = this.colorRgb.G;
|
||||
this.numBlue.Value = this.colorRgb.B;
|
||||
this.numHue.Value = (int)(((decimal)this.colorHsl.H) * 360M);
|
||||
this.numSaturation.Value = (int)(((decimal)this.colorHsl.S) * 100M);
|
||||
this.numLuminance.Value = (int)(((decimal)this.colorHsl.L) * 100M);
|
||||
this.lockUpdates = false;
|
||||
}
|
||||
|
||||
private void UpdateRgbFields(Color newColor)
|
||||
{
|
||||
this.colorHsl = HslColor.FromColor(newColor);
|
||||
this.colorRgb = newColor;
|
||||
this.lockUpdates = true;
|
||||
this.numHue.Value = (int)(((decimal)this.colorHsl.H) * 360M);
|
||||
this.numSaturation.Value = (int)(((decimal)this.colorHsl.S) * 100M);
|
||||
this.numLuminance.Value = (int)(((decimal)this.colorHsl.L) * 100M);
|
||||
this.lockUpdates = false;
|
||||
this.colorSlider.ColorHSL = this.colorHsl;
|
||||
this.colorBox2D.ColorHSL = this.colorHsl;
|
||||
}
|
||||
|
||||
private void UpdateHslFields(HslColor newColor)
|
||||
{
|
||||
this.colorHsl = newColor;
|
||||
this.colorRgb = newColor.RgbValue;
|
||||
this.lockUpdates = true;
|
||||
this.numRed.Value = this.colorRgb.R;
|
||||
this.numGreen.Value = this.colorRgb.G;
|
||||
this.numBlue.Value = this.colorRgb.B;
|
||||
this.lockUpdates = false;
|
||||
this.colorSlider.ColorHSL = this.colorHsl;
|
||||
this.colorBox2D.ColorHSL = this.colorHsl;
|
||||
}
|
||||
|
||||
private void numRed_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
UpdateRgbFields(Color.FromArgb((int)this.numRed.Value, (int)this.numGreen.Value, (int)this.numBlue.Value));
|
||||
}
|
||||
}
|
||||
|
||||
private void numGreen_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
UpdateRgbFields(Color.FromArgb((int)this.numRed.Value, (int)this.numGreen.Value, (int)this.numBlue.Value));
|
||||
}
|
||||
}
|
||||
|
||||
private void numBlue_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
UpdateRgbFields(Color.FromArgb((int)this.numRed.Value, (int)this.numGreen.Value, (int)this.numBlue.Value));
|
||||
}
|
||||
}
|
||||
|
||||
private void numHue_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
HslColor newColor = HslColor.FromAhsl((double)(((float)((int)this.numHue.Value)) / 360f), this.colorHsl.S, this.colorHsl.L);
|
||||
this.UpdateHslFields(newColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void numSaturation_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
HslColor newColor = HslColor.FromAhsl(this.colorHsl.A, this.colorHsl.H, (double)(((float)((int)this.numSaturation.Value)) / 100f), this.colorHsl.L);
|
||||
this.UpdateHslFields(newColor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void numLuminance_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!this.lockUpdates)
|
||||
{
|
||||
HslColor newColor = HslColor.FromAhsl(this.colorHsl.A, this.colorHsl.H, this.colorHsl.S, (double)(((float)((int)this.numLuminance.Value)) / 100f));
|
||||
this.UpdateHslFields(newColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Vendor/MechanikaDesign/ColorPicker.Demo/FormColorPickerDemo.resx
vendored
Normal file
120
Vendor/MechanikaDesign/ColorPicker.Demo/FormColorPickerDemo.resx
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
22
Vendor/MechanikaDesign/ColorPicker.Demo/Program.cs
vendored
Normal file
22
Vendor/MechanikaDesign/ColorPicker.Demo/Program.cs
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ColorHexagon.Demo
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormColorPickerDemo());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/AssemblyInfo.cs
vendored
Normal file
36
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/AssemblyInfo.cs
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Color Picker Controls Demonstration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Mechanika Design Color Picker Controls Library")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 Mechanika Design")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9cefab06-ff46-44ec-867f-50faeb88222a")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Resources.Designer.cs
generated
vendored
Normal file
63
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Resources.Designer.cs
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ColorPicker.Demo.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ColorPicker.Demo.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Resources.resx
vendored
Normal file
117
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Resources.resx
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Settings.Designer.cs
generated
vendored
Normal file
26
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Settings.Designer.cs
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ColorPicker.Demo.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Settings.settings
vendored
Normal file
7
Vendor/MechanikaDesign/ColorPicker.Demo/Properties/Settings.settings
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
28
Vendor/MechanikaDesign/ColorPickerControls.sln
vendored
Normal file
28
Vendor/MechanikaDesign/ColorPickerControls.sln
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker.Demo", "ColorPicker.Demo\ColorPicker.Demo.csproj", "{DF274AA1-5380-4B84-B9F5-FF66E6A1D37B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "ColorBox2D\ColorPicker.csproj", "{38F99682-D013-4AE3-8334-4BF492A11FF9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DF274AA1-5380-4B84-B9F5-FF66E6A1D37B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DF274AA1-5380-4B84-B9F5-FF66E6A1D37B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DF274AA1-5380-4B84-B9F5-FF66E6A1D37B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DF274AA1-5380-4B84-B9F5-FF66E6A1D37B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38F99682-D013-4AE3-8334-4BF492A11FF9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
122
Vendor/MechanikaDesign/ColorWheel/ColorHelper.cs
vendored
Normal file
122
Vendor/MechanikaDesign/ColorWheel/ColorHelper.cs
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MechanikaDesign.WinForms.UI.ColorPicker
|
||||
{
|
||||
public static class ColorHelper
|
||||
{
|
||||
// r,g,b values are from 0 to 1
|
||||
// h = [0,360], s = [0,1], v = [0,1]
|
||||
// if s == 0, then h = -1 (undefined)
|
||||
/// <summary>
|
||||
/// Generates the Hue, Saturation, and Value for a given color
|
||||
/// </summary>
|
||||
/// <param name="color">The Color to generate the values for</param>
|
||||
/// <param name="hue">Out value for Hue</param>
|
||||
/// <param name="saturation">Out value for Saturation</param>
|
||||
/// <param name="value">Out value for Value</param>
|
||||
public static void HSVFromRGB(Color color, out double hue, out double saturation, out double value)
|
||||
{
|
||||
double min, max, delta, r, g, b;
|
||||
r = (double)color.R / 255d;
|
||||
g = (double)color.G / 255d;
|
||||
b = (double)color.B / 255d;
|
||||
|
||||
min = Math.Min(r, Math.Min(g, b));
|
||||
max = Math.Max(r, Math.Max(g, b));
|
||||
value = max; // v
|
||||
delta = max - min;
|
||||
if (max != 0)
|
||||
saturation = delta / max; // s
|
||||
else
|
||||
{
|
||||
// r = g = b = 0 // s = 0, v is undefined
|
||||
saturation = 0;
|
||||
hue = -1;
|
||||
return;
|
||||
}
|
||||
if (r == max)
|
||||
hue = (g - b) / delta; // between yellow & magenta
|
||||
else if (g == max)
|
||||
hue = 2 + (b - r) / delta; // between cyan & yellow
|
||||
else
|
||||
hue = 4 + (r - g) / delta; // between magenta & cyan
|
||||
hue *= 60; // degrees
|
||||
if (hue < 0)
|
||||
hue += 360;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generates a Color from a Hue, Saturation, and Value combination
|
||||
/// </summary>
|
||||
/// <param name="hue">Hue to use for the Color. (Max 360)</param>
|
||||
/// <param name="saturation">Saturation to use for the Color. (Max 1.0)</param>
|
||||
/// <param name="value">Value to use for the Color. (Max 1.0)</param>
|
||||
/// <returns>Generated Color</returns>
|
||||
public static Color ColorFromHSV(double hue, double saturation, double value)
|
||||
{
|
||||
try
|
||||
{
|
||||
int i;
|
||||
double f, p, q, t, r, g, b;
|
||||
|
||||
if (saturation == 0)
|
||||
{
|
||||
// achromatic (grey)
|
||||
r = g = b = value;
|
||||
return Color.FromArgb((int)(255 * r), (int)(255 * g), (int)(255 * b));
|
||||
}
|
||||
hue /= 60; // sector 0 to 5
|
||||
i = (int)Math.Floor(hue);
|
||||
f = hue - i; // factorial part of h
|
||||
p = value * (1 - saturation);
|
||||
q = value * (1 - saturation * f);
|
||||
t = value * (1 - saturation * (1 - f));
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
r = value;
|
||||
g = t;
|
||||
b = p;
|
||||
break;
|
||||
case 1:
|
||||
r = q;
|
||||
g = value;
|
||||
b = p;
|
||||
break;
|
||||
case 2:
|
||||
r = p;
|
||||
g = value;
|
||||
b = t;
|
||||
break;
|
||||
case 3:
|
||||
r = p;
|
||||
g = q;
|
||||
b = value;
|
||||
break;
|
||||
case 4:
|
||||
r = t;
|
||||
g = p;
|
||||
b = value;
|
||||
break;
|
||||
default: // case 5:
|
||||
r = value;
|
||||
g = p;
|
||||
b = q;
|
||||
break;
|
||||
}
|
||||
return Color.FromArgb((int)(255 * r), (int)(255 * g), (int)(255 * b));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
return Color.Empty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
884
Vendor/MechanikaDesign/ColorWheel/ColorWheel.cs
vendored
Normal file
884
Vendor/MechanikaDesign/ColorWheel/ColorWheel.cs
vendored
Normal file
@@ -0,0 +1,884 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MechanikaDesign.WinForms.UI.ColorPicker
|
||||
{
|
||||
|
||||
[DefaultProperty("Color")]
|
||||
[DefaultEvent("ColorChanged")]
|
||||
public partial class ColorWheel: Control
|
||||
{
|
||||
private const int PADDING = 10;
|
||||
private const int INNER_RADIUS = 200;
|
||||
private const int OUTER_RADIUS = INNER_RADIUS + 50;
|
||||
|
||||
#region Fields
|
||||
|
||||
private Brush _brush;
|
||||
private PointF _centerPoint;
|
||||
private Color _color;
|
||||
private int _colorStep;
|
||||
private bool _dragStartedWithinWheel;
|
||||
private HslColor _hslColor;
|
||||
private int _largeChange;
|
||||
private float _radius;
|
||||
private int _selectionSize;
|
||||
private int _smallChange;
|
||||
private int _updateCount;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ColorWheel"/> class.
|
||||
/// </summary>
|
||||
public ColorWheel()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Selectable | ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, true);
|
||||
this.Color = Color.Black;
|
||||
this.ColorStep = 4;
|
||||
this.SelectionSize = 10;
|
||||
this.SmallChange = 1;
|
||||
this.LargeChange = 5;
|
||||
this.SelectionGlyph = this.CreateSelectionGlyph();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the Color property value changes
|
||||
/// </summary>
|
||||
[Category("Property Changed")]
|
||||
public event EventHandler ColorChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the ColorStep property value changes
|
||||
/// </summary>
|
||||
[Category("Property Changed")]
|
||||
public event EventHandler ColorStepChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the HslColor property value changes
|
||||
/// </summary>
|
||||
[Category("Property Changed")]
|
||||
public event EventHandler HslColorChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the LargeChange property value changes
|
||||
/// </summary>
|
||||
[Category("Property Changed")]
|
||||
public event EventHandler LargeChangeChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the SelectionSize property value changes
|
||||
/// </summary>
|
||||
[Category("Property Changed")]
|
||||
public event EventHandler SelectionSizeChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the SmallChange property value changes
|
||||
/// </summary>
|
||||
[Category("Property Changed")]
|
||||
public event EventHandler SmallChangeChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overridden Methods
|
||||
/// <summary>
|
||||
/// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.Control" /> and its child controls and optionally releases the managed resources.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_brush != null)
|
||||
{
|
||||
_brush.Dispose();
|
||||
}
|
||||
|
||||
if (this.SelectionGlyph != null)
|
||||
{
|
||||
this.SelectionGlyph.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified key is a regular input key or a special key that requires preprocessing.
|
||||
/// </summary>
|
||||
/// <param name="keyData">One of the <see cref="T:System.Windows.Forms.Keys" /> values.</param>
|
||||
/// <returns>true if the specified key is a regular input key; otherwise, false.</returns>
|
||||
protected override bool IsInputKey(Keys keyData)
|
||||
{
|
||||
bool result;
|
||||
|
||||
if ((keyData & Keys.Left) == Keys.Left || (keyData & Keys.Up) == Keys.Up || (keyData & Keys.Down) == Keys.Down || (keyData & Keys.Right) == Keys.Right || (keyData & Keys.PageUp) == Keys.PageUp || (keyData & Keys.PageDown) == Keys.PageDown)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = base.IsInputKey(keyData);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.GotFocus" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
|
||||
protected override void OnGotFocus(EventArgs e)
|
||||
{
|
||||
base.OnGotFocus(e);
|
||||
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.KeyDown" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">A <see cref="T:System.Windows.Forms.KeyEventArgs" /> that contains the event data.</param>
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
HslColor color;
|
||||
double hue;
|
||||
int step;
|
||||
|
||||
color = this.HslColor;
|
||||
hue = color.H;
|
||||
|
||||
step = e.Shift ? this.LargeChange : this.SmallChange;
|
||||
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Right:
|
||||
case Keys.Up:
|
||||
hue += step;
|
||||
break;
|
||||
case Keys.Left:
|
||||
case Keys.Down:
|
||||
hue -= step;
|
||||
break;
|
||||
case Keys.PageUp:
|
||||
hue += this.LargeChange;
|
||||
break;
|
||||
case Keys.PageDown:
|
||||
hue -= this.LargeChange;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hue >= 360)
|
||||
{
|
||||
hue = 0;
|
||||
}
|
||||
if (hue < 0)
|
||||
{
|
||||
hue = 359;
|
||||
}
|
||||
|
||||
if (hue != color.H)
|
||||
{
|
||||
color.H = hue;
|
||||
|
||||
// As the Color and HslColor properties update each other, need to temporarily disable this and manually set both
|
||||
// otherwise the wheel "sticks" due to imprecise conversion from RGB to HSL
|
||||
this.LockUpdates = true;
|
||||
this.Color = color.ToRgbColor();
|
||||
this.HslColor = color;
|
||||
this.LockUpdates = false;
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.LostFocus" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
|
||||
protected override void OnLostFocus(EventArgs e)
|
||||
{
|
||||
base.OnLostFocus(e);
|
||||
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.MouseDown" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param>
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
|
||||
if (!this.Focused && this.TabStop)
|
||||
{
|
||||
this.Focus();
|
||||
}
|
||||
|
||||
if (e.Button == MouseButtons.Left && this.IsPointInWheel(e.Location))
|
||||
{
|
||||
_dragStartedWithinWheel = true;
|
||||
this.SetColor(e.Location);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.MouseMove" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param>
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
if (e.Button == MouseButtons.Left && _dragStartedWithinWheel)
|
||||
{
|
||||
this.SetColor(e.Location);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.MouseUp"/> event.
|
||||
/// </summary>
|
||||
/// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data. </param>
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
|
||||
_dragStartedWithinWheel = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.PaddingChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">A <see cref="T:System.EventArgs" /> that contains the event data.</param>
|
||||
protected override void OnPaddingChanged(EventArgs e)
|
||||
{
|
||||
base.OnPaddingChanged(e);
|
||||
|
||||
this.RefreshWheel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (this.AllowPainting)
|
||||
{
|
||||
base.OnPaintBackground(e);
|
||||
|
||||
if (this.BackgroundImage == null && this.Parent != null && (this.BackColor == this.Parent.BackColor || this.Parent.BackColor.A != 255))
|
||||
{
|
||||
ButtonRenderer.DrawParentBackground(e.Graphics, this.DisplayRectangle, this);
|
||||
}
|
||||
|
||||
if (_brush != null)
|
||||
{
|
||||
e.Graphics.FillPie(_brush, this.ClientRectangle, 0, 360);
|
||||
}
|
||||
|
||||
// smooth out the edge of the wheel
|
||||
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
using (Pen pen = new Pen(this.BackColor, 2))
|
||||
{
|
||||
e.Graphics.DrawEllipse(pen, new RectangleF(_centerPoint.X - _radius, _centerPoint.Y - _radius, _radius * 2, _radius * 2));
|
||||
}
|
||||
|
||||
if (!this.Color.IsEmpty)
|
||||
{
|
||||
this.PaintCurrentColor(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="E:System.Windows.Forms.Control.Resize" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param>
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
this.RefreshWheel();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the component color.
|
||||
/// </summary>
|
||||
/// <value>The component color.</value>
|
||||
[Category("Appearance")]
|
||||
[DefaultValue(typeof(Color), "Black")]
|
||||
public virtual Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
if (this.Color != value)
|
||||
{
|
||||
_color = value;
|
||||
|
||||
this.OnColorChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the increment for rendering the color wheel.
|
||||
/// </summary>
|
||||
/// <value>The color step.</value>
|
||||
/// <exception cref="System.ArgumentOutOfRangeException">Value must be between 1 and 359</exception>
|
||||
[Category("Appearance")]
|
||||
[DefaultValue(4)]
|
||||
public virtual int ColorStep
|
||||
{
|
||||
get { return _colorStep; }
|
||||
set
|
||||
{
|
||||
if (value < 1 || value > 359)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", value, "Value must be between 1 and 359");
|
||||
}
|
||||
|
||||
if (this.ColorStep != value)
|
||||
{
|
||||
_colorStep = value;
|
||||
|
||||
this.OnColorStepChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the component color.
|
||||
/// </summary>
|
||||
/// <value>The component color.</value>
|
||||
[Category("Appearance")]
|
||||
[DefaultValue(typeof(HslColor), "0, 0, 0")]
|
||||
[Browsable(false) /* disable editing until I write a proper type convertor */]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public virtual HslColor HslColor
|
||||
{
|
||||
get { return _hslColor; }
|
||||
set
|
||||
{
|
||||
if (this.HslColor != value)
|
||||
{
|
||||
_hslColor = value;
|
||||
|
||||
this.OnHslColorChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value to be added to or subtracted from the <see cref="Color"/> property when the wheel selection is moved a large distance.
|
||||
/// </summary>
|
||||
/// <value>A numeric value. The default value is 5.</value>
|
||||
[Category("Behavior")]
|
||||
[DefaultValue(5)]
|
||||
public virtual int LargeChange
|
||||
{
|
||||
get { return _largeChange; }
|
||||
set
|
||||
{
|
||||
if (this.LargeChange != value)
|
||||
{
|
||||
_largeChange = value;
|
||||
|
||||
this.OnLargeChangeChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the selection handle.
|
||||
/// </summary>
|
||||
/// <value>The size of the selection handle.</value>
|
||||
[Category("Appearance")]
|
||||
[DefaultValue(10)]
|
||||
public virtual int SelectionSize
|
||||
{
|
||||
get { return _selectionSize; }
|
||||
set
|
||||
{
|
||||
if (this.SelectionSize != value)
|
||||
{
|
||||
_selectionSize = value;
|
||||
|
||||
this.OnSelectionSizeChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value to be added to or subtracted from the <see cref="Color"/> property when the wheel selection is moved a small distance.
|
||||
/// </summary>
|
||||
/// <value>A numeric value. The default value is 1.</value>
|
||||
[Category("Behavior")]
|
||||
[DefaultValue(1)]
|
||||
public virtual int SmallChange
|
||||
{
|
||||
get { return _smallChange; }
|
||||
set
|
||||
{
|
||||
if (this.SmallChange != value)
|
||||
{
|
||||
_smallChange = value;
|
||||
|
||||
this.OnSmallChangeChanged(EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether painting of the control is allowed.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if painting of the control is allowed; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
protected virtual bool AllowPainting
|
||||
{
|
||||
get { return _updateCount == 0; }
|
||||
}
|
||||
|
||||
protected Color[] Colors { get; set; }
|
||||
|
||||
protected bool LockUpdates { get; set; }
|
||||
|
||||
protected PointF[] Points { get; set; }
|
||||
|
||||
protected Image SelectionGlyph { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Disables any redrawing of the image box
|
||||
/// </summary>
|
||||
public virtual void BeginUpdate()
|
||||
{
|
||||
_updateCount++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables the redrawing of the image box
|
||||
/// </summary>
|
||||
public virtual void EndUpdate()
|
||||
{
|
||||
if (_updateCount > 0)
|
||||
{
|
||||
_updateCount--;
|
||||
}
|
||||
|
||||
if (this.AllowPainting)
|
||||
{
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Members
|
||||
|
||||
/// <summary>
|
||||
/// Calculates wheel attributes.
|
||||
/// </summary>
|
||||
protected virtual void CalculateWheel()
|
||||
{
|
||||
List<PointF> points;
|
||||
List<Color> colors;
|
||||
|
||||
points = new List<PointF>();
|
||||
colors = new List<Color>();
|
||||
|
||||
// Only define the points if the control is above a minimum size, otherwise if it's too small,
|
||||
// you get an "out of memory" exceptions (of all things) when creating the brush
|
||||
if (this.ClientSize.Width > 16 && this.ClientSize.Height > 16)
|
||||
{
|
||||
int w;
|
||||
int h;
|
||||
|
||||
w = this.ClientSize.Width;
|
||||
h = this.ClientSize.Height;
|
||||
|
||||
_centerPoint = new PointF(w / 2.0F, h / 2.0F);
|
||||
_radius = this.GetRadius(_centerPoint);
|
||||
|
||||
for (double angle = 0; angle < 360; angle += this.ColorStep)
|
||||
{
|
||||
double angleR;
|
||||
PointF location;
|
||||
|
||||
angleR = angle * (Math.PI / 180);
|
||||
location = this.GetColorLocation(angleR, _radius);
|
||||
|
||||
points.Add(location);
|
||||
colors.Add(new HslColor(angle, 1, 0.5).ToRgbColor());
|
||||
}
|
||||
}
|
||||
|
||||
this.Points = points.ToArray();
|
||||
this.Colors = colors.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the gradient brush used to paint the wheel.
|
||||
/// </summary>
|
||||
protected virtual Brush CreateGradientBrush()
|
||||
{
|
||||
Brush result;
|
||||
|
||||
if (this.Points.Length != 0 && this.Points.Length == this.Colors.Length)
|
||||
{
|
||||
result = new PathGradientBrush(this.Points, WrapMode.Clamp)
|
||||
{
|
||||
CenterPoint = _centerPoint,
|
||||
CenterColor = Color.White,
|
||||
SurroundColors = this.Colors
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the selection glyph.
|
||||
/// </summary>
|
||||
protected virtual Image CreateSelectionGlyph()
|
||||
{
|
||||
Image image;
|
||||
int halfSize;
|
||||
|
||||
halfSize = this.SelectionSize / 2;
|
||||
image = new Bitmap(this.SelectionSize + 1, this.SelectionSize + 1);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
{
|
||||
Point[] diamondOuter;
|
||||
|
||||
diamondOuter = new[]
|
||||
{
|
||||
new Point(halfSize, 0), new Point(this.SelectionSize, halfSize), new Point(halfSize, this.SelectionSize), new Point(0, halfSize)
|
||||
};
|
||||
|
||||
g.FillPolygon(SystemBrushes.Control, diamondOuter);
|
||||
g.DrawPolygon(SystemPens.ControlDark, diamondOuter);
|
||||
|
||||
using (Pen pen = new Pen(Color.FromArgb(128, SystemColors.ControlDark)))
|
||||
{
|
||||
g.DrawLine(pen, halfSize, 1, this.SelectionSize - 1, halfSize);
|
||||
g.DrawLine(pen, halfSize, 2, this.SelectionSize - 2, halfSize);
|
||||
g.DrawLine(pen, halfSize, this.SelectionSize - 1, this.SelectionSize - 2, halfSize + 1);
|
||||
g.DrawLine(pen, halfSize, this.SelectionSize - 2, this.SelectionSize - 3, halfSize + 1);
|
||||
}
|
||||
|
||||
using (Pen pen = new Pen(Color.FromArgb(196, SystemColors.ControlLightLight)))
|
||||
{
|
||||
g.DrawLine(pen, halfSize, this.SelectionSize - 1, 1, halfSize);
|
||||
}
|
||||
|
||||
g.DrawLine(SystemPens.ControlLightLight, 1, halfSize, halfSize, 1);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the point within the wheel representing the source color.
|
||||
/// </summary>
|
||||
/// <param name="color">The color.</param>
|
||||
protected PointF GetColorLocation(Color color)
|
||||
{
|
||||
return this.GetColorLocation(new HslColor(color));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the point within the wheel representing the source color.
|
||||
/// </summary>
|
||||
/// <param name="color">The color.</param>
|
||||
protected virtual PointF GetColorLocation(HslColor color)
|
||||
{
|
||||
double angle;
|
||||
double radius;
|
||||
|
||||
angle = color.H * Math.PI / 180;
|
||||
radius = _radius * color.S;
|
||||
|
||||
return this.GetColorLocation(angle, radius);
|
||||
}
|
||||
|
||||
protected PointF GetColorLocation(double angleR, double radius)
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
|
||||
x = this.Padding.Left + _centerPoint.X + Math.Cos(angleR) * radius;
|
||||
y = this.Padding.Top + _centerPoint.Y - Math.Sin(angleR) * radius;
|
||||
|
||||
return new PointF((float)x, (float)y);
|
||||
}
|
||||
|
||||
protected float GetRadius(PointF centerPoint)
|
||||
{
|
||||
return Math.Min(centerPoint.X, centerPoint.Y) - (Math.Max(this.Padding.Horizontal, this.Padding.Vertical) + (this.SelectionSize / 2));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified point is within the bounds of the color wheel.
|
||||
/// </summary>
|
||||
/// <param name="point">The point.</param>
|
||||
/// <returns><c>true</c> if the specified point is within the bounds of the color wheel; otherwise, <c>false</c>.</returns>
|
||||
protected bool IsPointInWheel(Point point)
|
||||
{
|
||||
PointF normalized;
|
||||
|
||||
// http://my.safaribooksonline.com/book/programming/csharp/9780672331985/graphics-with-windows-forms-and-gdiplus/ch17lev1sec21
|
||||
|
||||
normalized = new PointF(point.X - _centerPoint.X, point.Y - _centerPoint.Y);
|
||||
|
||||
return (normalized.X * normalized.X + normalized.Y * normalized.Y) <= (_radius * _radius);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="ColorChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void OnColorChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler;
|
||||
|
||||
if (!this.LockUpdates)
|
||||
{
|
||||
this.HslColor = new HslColor(this.Color);
|
||||
}
|
||||
this.Refresh();
|
||||
|
||||
handler = this.ColorChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="ColorStepChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void OnColorStepChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler;
|
||||
|
||||
this.RefreshWheel();
|
||||
|
||||
handler = this.ColorStepChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="HslColorChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void OnHslColorChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler;
|
||||
|
||||
if (!this.LockUpdates)
|
||||
{
|
||||
this.Color = this.HslColor.ToRgbColor();
|
||||
}
|
||||
this.Invalidate();
|
||||
|
||||
handler = this.HslColorChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="LargeChangeChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void OnLargeChangeChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler;
|
||||
|
||||
handler = this.LargeChangeChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="SelectionSizeChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void OnSelectionSizeChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler;
|
||||
|
||||
if (this.SelectionGlyph != null)
|
||||
{
|
||||
this.SelectionGlyph.Dispose();
|
||||
}
|
||||
|
||||
this.SelectionGlyph = this.CreateSelectionGlyph();
|
||||
this.RefreshWheel();
|
||||
|
||||
handler = this.SelectionSizeChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the <see cref="SmallChangeChanged" /> event.
|
||||
/// </summary>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void OnSmallChangeChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler;
|
||||
|
||||
handler = this.SmallChangeChanged;
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void PaintColor(PaintEventArgs e, HslColor color)
|
||||
{
|
||||
this.PaintColor(e, color, false);
|
||||
}
|
||||
|
||||
protected virtual void PaintColor(PaintEventArgs e, HslColor color, bool includeFocus)
|
||||
{
|
||||
PointF location;
|
||||
|
||||
location = this.GetColorLocation(color);
|
||||
|
||||
if (!float.IsNaN(location.X) && !float.IsNaN(location.Y))
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
|
||||
x = (int)location.X - (this.SelectionSize / 2);
|
||||
y = (int)location.Y - (this.SelectionSize / 2);
|
||||
|
||||
if (this.SelectionGlyph == null)
|
||||
{
|
||||
e.Graphics.DrawRectangle(Pens.Black, x, y, this.SelectionSize, this.SelectionSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawImage(this.SelectionGlyph, x, y);
|
||||
}
|
||||
|
||||
if (this.Focused && includeFocus)
|
||||
{
|
||||
ControlPaint.DrawFocusRectangle(e.Graphics, new Rectangle(x - 1, y - 1, this.SelectionSize + 2, this.SelectionSize + 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void PaintCurrentColor(PaintEventArgs e)
|
||||
{
|
||||
this.PaintColor(e, this.HslColor, true);
|
||||
}
|
||||
|
||||
protected virtual void SetColor(Point point)
|
||||
{
|
||||
double dx;
|
||||
double dy;
|
||||
double angle;
|
||||
double distance;
|
||||
double saturation;
|
||||
|
||||
dx = Math.Abs(point.X - _centerPoint.X - this.Padding.Left);
|
||||
dy = Math.Abs(point.Y - _centerPoint.Y - this.Padding.Top);
|
||||
angle = Math.Atan(dy / dx) / Math.PI * 180;
|
||||
distance = Math.Pow((Math.Pow(dx, 2) + (Math.Pow(dy, 2))), 0.5);
|
||||
saturation = distance / _radius;
|
||||
|
||||
if (distance < 6)
|
||||
{
|
||||
saturation = 0; // snap to center
|
||||
}
|
||||
|
||||
if (point.X < _centerPoint.X)
|
||||
{
|
||||
angle = 180 - angle;
|
||||
}
|
||||
if (point.Y > _centerPoint.Y)
|
||||
{
|
||||
angle = 360 - angle;
|
||||
}
|
||||
|
||||
this.LockUpdates = true;
|
||||
this.HslColor = new HslColor(angle, saturation, 0.5);
|
||||
this.Color = this.HslColor.ToRgbColor();
|
||||
this.LockUpdates = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the wheel attributes and then repaints the control
|
||||
/// </summary>
|
||||
private void RefreshWheel()
|
||||
{
|
||||
if (_brush != null)
|
||||
{
|
||||
_brush.Dispose();
|
||||
}
|
||||
|
||||
this.CalculateWheel();
|
||||
_brush = this.CreateGradientBrush();
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
60
Vendor/MechanikaDesign/ColorWheel/ColorWheel.csproj
vendored
Normal file
60
Vendor/MechanikaDesign/ColorWheel/ColorWheel.csproj
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A9F7F23D-AE72-4FC9-9B55-FCF21F0AE333}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ColorWheel</RootNamespace>
|
||||
<AssemblyName>ColorWheel</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ColorWheel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ColorHelper.cs" />
|
||||
<Compile Include="HslColor.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
231
Vendor/MechanikaDesign/ColorWheel/HslColor.cs
vendored
Normal file
231
Vendor/MechanikaDesign/ColorWheel/HslColor.cs
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
namespace MechanikaDesign.WinForms.UI.ColorPicker
|
||||
{
|
||||
[Serializable]
|
||||
public struct HslColor
|
||||
{
|
||||
#region Constants
|
||||
|
||||
public static readonly HslColor Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
||||
private double hue;
|
||||
private double saturation;
|
||||
private double luminance;
|
||||
private int alpha;
|
||||
private bool isEmpty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Static Constructors
|
||||
|
||||
static HslColor()
|
||||
{
|
||||
Empty = new HslColor
|
||||
{
|
||||
IsEmpty = true
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public HslColor(double h, double s, double l)
|
||||
: this(255, h, s, l)
|
||||
{ }
|
||||
|
||||
public HslColor(int a, double h, double s, double l)
|
||||
{
|
||||
this.alpha = a;
|
||||
this.hue = Math.Min(359, h);
|
||||
this.saturation = Math.Min(1, s);
|
||||
this.luminance = Math.Min(1, l);
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
public HslColor(Color color)
|
||||
{
|
||||
this.alpha = color.A;
|
||||
this.hue = color.GetHue();
|
||||
this.saturation = color.GetSaturation();
|
||||
this.luminance = color.GetBrightness();
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
public static bool operator ==(HslColor left, HslColor right)
|
||||
{
|
||||
return (((left.A == right.A) && (left.H == right.H)) && ((left.S == right.S) && (left.L == right.L)));
|
||||
}
|
||||
|
||||
public static bool operator !=(HslColor left, HslColor right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public static implicit operator HslColor(Color color)
|
||||
{
|
||||
return new HslColor(color);
|
||||
}
|
||||
|
||||
public static implicit operator Color(HslColor color)
|
||||
{
|
||||
return color.ToRgbColor();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overridden Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is HslColor)
|
||||
{
|
||||
HslColor color = (HslColor)obj;
|
||||
if (((this.A == color.A) && (this.H == color.H)) && ((this.S == color.S) && (this.L == color.L)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((this.alpha.GetHashCode() ^ this.hue.GetHashCode()) ^ this.saturation.GetHashCode()) ^ this.luminance.GetHashCode());
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
builder = new StringBuilder();
|
||||
builder.Append(this.GetType().Name);
|
||||
builder.Append(" [");
|
||||
builder.Append("H=");
|
||||
builder.Append(this.H);
|
||||
builder.Append(", S=");
|
||||
builder.Append(this.S);
|
||||
builder.Append(", L=");
|
||||
builder.Append(this.L);
|
||||
builder.Append("]");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Members
|
||||
|
||||
public double H
|
||||
{
|
||||
get { return this.hue; }
|
||||
set
|
||||
{
|
||||
this.hue = value;
|
||||
this.hue = (this.hue > 359.0) ? 0 : ((this.hue < 0.0) ? 359 : this.hue);
|
||||
}
|
||||
}
|
||||
|
||||
public double S
|
||||
{
|
||||
get { return this.saturation; }
|
||||
set { this.saturation = Math.Min(1, Math.Max(0, value)); }
|
||||
}
|
||||
|
||||
public double L
|
||||
{
|
||||
get { return this.luminance; }
|
||||
set { this.luminance = Math.Min(1, Math.Max(0, value)); }
|
||||
}
|
||||
|
||||
public int A
|
||||
{
|
||||
get { return this.alpha; }
|
||||
set { this.alpha = Math.Min(0, Math.Max(255, value)); }
|
||||
}
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get { return isEmpty; }
|
||||
internal set { isEmpty = value; }
|
||||
}
|
||||
|
||||
public Color ToRgbColor()
|
||||
{
|
||||
return this.ToRgbColor(this.A);
|
||||
}
|
||||
|
||||
public Color ToRgbColor(int alpha)
|
||||
{
|
||||
double q;
|
||||
if (this.L < 0.5)
|
||||
{
|
||||
q = this.L * (1 + this.S);
|
||||
}
|
||||
else
|
||||
{
|
||||
q = this.L + this.S - (this.L * this.S);
|
||||
}
|
||||
double p = 2 * this.L - q;
|
||||
double hk = this.H / 360;
|
||||
|
||||
// r,g,b colors
|
||||
double[] tc = new[]
|
||||
{
|
||||
hk + (1d / 3d), hk, hk - (1d / 3d)
|
||||
};
|
||||
double[] colors = new[]
|
||||
{
|
||||
0.0, 0.0, 0.0
|
||||
};
|
||||
|
||||
for (int color = 0; color < colors.Length; color++)
|
||||
{
|
||||
if (tc[color] < 0)
|
||||
{
|
||||
tc[color] += 1;
|
||||
}
|
||||
if (tc[color] > 1)
|
||||
{
|
||||
tc[color] -= 1;
|
||||
}
|
||||
|
||||
if (tc[color] < (1d / 6d))
|
||||
{
|
||||
colors[color] = p + ((q - p) * 6 * tc[color]);
|
||||
}
|
||||
else if (tc[color] >= (1d / 6d) && tc[color] < (1d / 2d))
|
||||
{
|
||||
colors[color] = q;
|
||||
}
|
||||
else if (tc[color] >= (1d / 2d) && tc[color] < (2d / 3d))
|
||||
{
|
||||
colors[color] = p + ((q - p) * 6 * (2d / 3d - tc[color]));
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[color] = p;
|
||||
}
|
||||
|
||||
colors[color] *= 255;
|
||||
}
|
||||
|
||||
return Color.FromArgb(alpha, (int)colors[0], (int)colors[1], (int)colors[2]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
36
Vendor/MechanikaDesign/ColorWheel/Properties/AssemblyInfo.cs
vendored
Normal file
36
Vendor/MechanikaDesign/ColorWheel/Properties/AssemblyInfo.cs
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ColorWheel")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ColorWheel")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0bfcd6ed-a4f8-47f9-b101-836ee495cd96")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Reference in New Issue
Block a user