mirror of
https://github.com/CTCaer/jc_toolkit
synced 2026-11-26 09:08:07 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
267c4c4e33 | ||
|
|
f837df0f89 | ||
|
|
96d6a4591a | ||
|
|
ee395c46e8 | ||
|
|
4de5f875b1 | ||
|
|
f448431824 | ||
|
|
5c6cd7d5ca | ||
|
|
dbada35a96 | ||
|
|
e10133079d | ||
|
|
fbeee89623 | ||
|
|
e996013526 | ||
|
|
714dfb9169 | ||
|
|
a898b6ead7 | ||
|
|
8fcc0a398f | ||
|
|
04076de71e | ||
|
|
b7b4da3974 | ||
|
|
4cc82e4360 | ||
|
|
5c97ce558e | ||
|
|
42e7a064c6 | ||
|
|
fb9bdc6cdf | ||
|
|
8d3d70eb12 | ||
|
|
4c815551c5 | ||
|
|
2d0e56a7d4 | ||
|
|
d8a977fd68 |
No files matched your search
@@ -1,16 +1,17 @@
|
||||
# Joy-Con Toolkit
|
||||
Joy-Con Toolkit
|
||||
|
||||
## Prerequisites:
|
||||
|
||||
Needs .NET Framework 4.5.2
|
||||
**Microsoft Visual C++ 2017 (x86) Redistributable** (All Windows versions)
|
||||
|
||||
**Microsoft .NET Framework 4.7.1** (for Windows lower than Windows 10)
|
||||
|
||||
## References:
|
||||
|
||||
Official forum: https://gbatemp.net/threads/tool-joy-con-toolkit-v1-0.478560/
|
||||
**Official forum** and **Binary releases**: https://gbatemp.net/threads/tool-joy-con-toolkit-v1-0.478560/
|
||||
|
||||
Protocol reverse engineering: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering
|
||||
**Protocol reverse engineering**: https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering
|
||||
|
||||
Protocol and hidapi usage in Linux: https://github.com/shinyquagsire23/HID-Joy-Con-Whispering
|
||||
**Protocol and hidapi usage in Linux**: https://github.com/shinyquagsire23/HID-Joy-Con-Whispering
|
||||
|
||||
In windows: https://github.com/shuffle2/nxpad
|
||||
**In windows**: https://github.com/shuffle2/nxpad
|
||||
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jctool", "jctool\jctool.vcxproj", "{DF218734-A810-4FFF-8164-638680773512}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jctool", "jctool\jctool.vs2017.vcxproj", "{DF218734-A810-4FFF-8164-638680773512}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jcColorDialog", "jctool\jc_colorpicker\jcColorDialog.vs2017.csproj", "{22E08F67-4E40-4A92-876B-410FFD49B20E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -12,6 +14,8 @@ Global
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DF218734-A810-4FFF-8164-638680773512}.Release|x86.ActiveCfg = Release|Win32
|
||||
{DF218734-A810-4FFF-8164-638680773512}.Release|x86.Build.0 = Release|Win32
|
||||
{22E08F67-4E40-4A92-876B-410FFD49B20E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{22E08F67-4E40-4A92-876B-410FFD49B20E}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<!--Values are in BGR not in RGB-->
|
||||
<!--Bodycolor for JoyCon-->
|
||||
<bodycolors>
|
||||
<bodycolors_v key="CustomColor" value="828282" />
|
||||
<bodycolors_v key="CustomColor" value="E6B90A" />
|
||||
<bodycolors_v key="CustomColor" value="283CFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFE6" />
|
||||
<bodycolors_v key="CustomColor" value="7832FF" />
|
||||
<bodycolors_v key="CustomColor" value="DC1E" />
|
||||
<bodycolors_v key="CustomColor" value="000FE1" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_v key="CustomColor" value="FFFFFF" />
|
||||
</bodycolors>
|
||||
<!--Body color for Pro Controller-->
|
||||
<bodycolors_pro>
|
||||
<bodycolors_pro_v key="CustomColor" value="323232" />
|
||||
<bodycolors_pro_v key="CustomColor" value="323231" />
|
||||
<bodycolors_pro_v key="CustomColor" value="828282" />
|
||||
<bodycolors_pro_v key="CustomColor" value="E6B90A" />
|
||||
<bodycolors_pro_v key="CustomColor" value="283CFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFE6" />
|
||||
<bodycolors_pro_v key="CustomColor" value="7832FF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="DC1E" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
<bodycolors_pro_v key="CustomColor" value="FFFFFF" />
|
||||
</bodycolors_pro>
|
||||
<!--Button color for Pro Controller-->
|
||||
<buttoncolors>
|
||||
<buttoncolors_v key="CustomColor" value="F0F0F" />
|
||||
<buttoncolors_v key="CustomColor" value="1E1E00" />
|
||||
<buttoncolors_v key="CustomColor" value="A0A1E" />
|
||||
<buttoncolors_v key="CustomColor" value="2814" />
|
||||
<buttoncolors_v key="CustomColor" value="1E0028" />
|
||||
<buttoncolors_v key="CustomColor" value="2800" />
|
||||
<buttoncolors_v key="CustomColor" value="0A0A28" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
<buttoncolors_v key="CustomColor" value="FFFFFF" />
|
||||
</buttoncolors>
|
||||
</configuration>
|
||||
+3954
-3598
File diff suppressed because it is too large.
Load diff
+2
-11
@@ -117,12 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="colorDialog2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>138, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>259, 17</value>
|
||||
</metadata>
|
||||
@@ -176,12 +170,9 @@ Click to change between Celsius and Fahrenheit </value>
|
||||
<value>Make a backup first!
|
||||
If you lose your serial number, bad things will happen!
|
||||
|
||||
If you currently have the stock S/N, this will also create a backup of it inside the SPI.
|
||||
If you currently have the stock S/N, this will create a backup of it inside SPI.
|
||||
|
||||
Restore it either here from the SPI backed up S/N or through Restore option from your SPI backup.
|
||||
|
||||
|
||||
Maximum 15 ASCII characters.</value>
|
||||
Restore it either here from the SPI backed up S/N or through Restore option.</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
+77
-82
@@ -1,92 +1,87 @@
|
||||
#pragma once
|
||||
namespace Overrides {
|
||||
public ref class TestColorTable : ProfessionalColorTable
|
||||
{
|
||||
public: property Color ToolStripDropDownBackground
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemSelected
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color MenuBorder
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemBorder
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(70, 70, 70);
|
||||
}
|
||||
}
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Drawing;
|
||||
|
||||
public: property Color MenuItemPressedGradientBegin
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public ref class TestColorTable : ProfessionalColorTable {
|
||||
public: property Color ToolStripDropDownBackground
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemPressedGradientEnd
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color ImageMarginGradientBegin
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemSelected
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color ImageMarginGradientEnd
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
public: property Color MenuBorder
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemSelectedGradientBegin
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
public: property Color MenuItemSelectedGradientEnd
|
||||
{
|
||||
virtual Color get() override
|
||||
{
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
public: property Color MenuItemBorder
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(70, 70, 70);
|
||||
}
|
||||
}
|
||||
|
||||
public ref class OverrideTSSR : ToolStripSystemRenderer
|
||||
{
|
||||
public: OverrideTSSR() { }
|
||||
public: property Color MenuItemPressedGradientBegin
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
protected: virtual void OnRenderToolStripBorder(ToolStripRenderEventArgs^ e) override
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
};
|
||||
public: property Color MenuItemPressedGradientEnd
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color ImageMarginGradientBegin
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color ImageMarginGradientEnd
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(55, 55, 55);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemSelectedGradientBegin
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
public: property Color MenuItemSelectedGradientEnd
|
||||
{
|
||||
virtual Color get() override {
|
||||
return Color::FromArgb(85, 85, 85);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public ref class OverrideTSSR : ToolStripSystemRenderer {
|
||||
public: OverrideTSSR() {}
|
||||
|
||||
protected: virtual void OnRenderToolStripBorder(ToolStripRenderEventArgs^ e) override {
|
||||
// Do nothing
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- Per Monitor V1 [OS >= Windows 8.1]
|
||||
Values: False, True, Per-monitor, True/PM -->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<!-- Per Monitor V1 [OS >= Windows 10 Anniversary Update (1607, 10.0.14393, Redstone 1)]
|
||||
Values: Unaware, System, PerMonitor -->
|
||||
<!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)]
|
||||
Value: PerMonitorV2 -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
+1283
-602
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,312 @@
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** Project: Joy-Con Color Picker *****/
|
||||
/***** Filename: AdobeColors.cs *****/
|
||||
/***** Original Project: Adobe Color Picker Clone 1 *****/
|
||||
/***** Original Author: Danny Blanchard *****/
|
||||
/***** - scrabcakes@gmail.com *****/
|
||||
/***** Updates: *****/
|
||||
/***** 3/28/2005 - Initial Version : Danny Blanchard *****/
|
||||
/***** Feb 2018 - JoyCon Version : CTCaer *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** This version is heavily optimised for use in *****/
|
||||
/***** CTCaer's Joy-Con Toolkit and other projects. *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace jcColor {
|
||||
/// <summary>
|
||||
/// Summary description for AdobeColors.
|
||||
/// </summary>
|
||||
public class AdobeColors
|
||||
{
|
||||
#region Constructors / Destructors
|
||||
|
||||
public AdobeColors()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sets the absolute brightness of a colour
|
||||
/// </summary>
|
||||
/// <param name="c">Original colour</param>
|
||||
/// <param name="brightness">The luminance level to impose</param>
|
||||
/// <returns>an adjusted colour</returns>
|
||||
public static Color SetBrightness(Color c, double brightness)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.L=brightness;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an existing brightness level
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To reduce brightness use a number smaller than 1. To increase brightness use a number larger tnan 1
|
||||
/// </remarks>
|
||||
/// <param name="c">The original colour</param>
|
||||
/// <param name="brightness">The luminance delta</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color ModifyBrightness(Color c, double brightness)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.L*=brightness;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the absolute saturation level
|
||||
/// </summary>
|
||||
/// <remarks>Accepted values 0-1</remarks>
|
||||
/// <param name="c">An original colour</param>
|
||||
/// <param name="Saturation">The saturation value to impose</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color SetSaturation(Color c, double Saturation)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.S=Saturation;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an existing Saturation level
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To reduce Saturation use a number smaller than 1. To increase Saturation use a number larger tnan 1
|
||||
/// </remarks>
|
||||
/// <param name="c">The original colour</param>
|
||||
/// <param name="Saturation">The saturation delta</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color ModifySaturation(Color c, double Saturation)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.S*=Saturation;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the absolute Hue level
|
||||
/// </summary>
|
||||
/// <remarks>Accepted values 0-1</remarks>
|
||||
/// <param name="c">An original colour</param>
|
||||
/// <param name="Hue">The Hue value to impose</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color SetHue(Color c, double Hue)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.H=Hue;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Modifies an existing Hue level
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To reduce Hue use a number smaller than 1. To increase Hue use a number larger tnan 1
|
||||
/// </remarks>
|
||||
/// <param name="c">The original colour</param>
|
||||
/// <param name="Hue">The Hue delta</param>
|
||||
/// <returns>An adjusted colour</returns>
|
||||
public static Color ModifyHue(Color c, double Hue)
|
||||
{
|
||||
HSL hsl = RGB_to_HSL(c);
|
||||
hsl.H*=Hue;
|
||||
return HSL_to_RGB(hsl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a colour from HSL to RGB
|
||||
/// </summary>
|
||||
/// <remarks>Adapted from the algoritm in Foley and Van-Dam</remarks>
|
||||
/// <param name="hsl">The HSL value</param>
|
||||
/// <returns>A Color structure containing the equivalent RGB values</returns>
|
||||
public static Color HSL_to_RGB(HSL hsl)
|
||||
{
|
||||
int Max, Mid, Min;
|
||||
double q;
|
||||
|
||||
Max = Round(hsl.L * 255);
|
||||
Min = Round((1.0 - hsl.S)*(hsl.L/1.0)*255);
|
||||
q = (double)(Max - Min)/255;
|
||||
|
||||
if ( hsl.H >= 0 && hsl.H <= (double)1/6 )
|
||||
{
|
||||
Mid = Round(((hsl.H - 0) * q) * 1530 + Min);
|
||||
return Color.FromArgb(Max,Mid,Min);
|
||||
}
|
||||
else if ( hsl.H <= (double)1/3 )
|
||||
{
|
||||
Mid = Round(-((hsl.H - (double)1/6) * q) * 1530 + Max);
|
||||
return Color.FromArgb(Mid,Max,Min);
|
||||
}
|
||||
else if ( hsl.H <= 0.5 )
|
||||
{
|
||||
Mid = Round(((hsl.H - (double)1/3) * q) * 1530 + Min);
|
||||
return Color.FromArgb(Min,Max,Mid);
|
||||
}
|
||||
else if ( hsl.H <= (double)2/3 )
|
||||
{
|
||||
Mid = Round(-((hsl.H - 0.5) * q) * 1530 + Max);
|
||||
return Color.FromArgb(Min,Mid,Max);
|
||||
}
|
||||
else if ( hsl.H <= (double)5/6 )
|
||||
{
|
||||
Mid = Round(((hsl.H - (double)2/3) * q) * 1530 + Min);
|
||||
return Color.FromArgb(Mid,Min,Max);
|
||||
}
|
||||
else if ( hsl.H <= 1.0 )
|
||||
{
|
||||
Mid = Round(-((hsl.H - (double)5/6) * q) * 1530 + Max);
|
||||
return Color.FromArgb(Max,Min,Mid);
|
||||
}
|
||||
else return Color.FromArgb(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts RGB to HSL
|
||||
/// </summary>
|
||||
/// <remarks>Takes advantage of whats already built in to .NET by using the Color.GetHue, Color.GetSaturation and Color.GetBrightness methods</remarks>
|
||||
/// <param name="c">A Color to convert</param>
|
||||
/// <returns>An HSL value</returns>
|
||||
public static HSL RGB_to_HSL (Color c)
|
||||
{
|
||||
HSL hsl = new HSL();
|
||||
|
||||
int Max, Min, Diff, Sum;
|
||||
|
||||
// Of our RGB values, assign the highest value to Max, and the Smallest to Min
|
||||
if ( c.R > c.G ) { Max = c.R; Min = c.G; }
|
||||
else { Max = c.G; Min = c.R; }
|
||||
if ( c.B > Max ) Max = c.B;
|
||||
else if ( c.B < Min ) Min = c.B;
|
||||
|
||||
Diff = Max - Min;
|
||||
Sum = Max + Min;
|
||||
|
||||
// Luminance - a.k.a. Brightness - Adobe photoshop uses the logic that the
|
||||
// site VBspeed regards (regarded) as too primitive = superior decides the
|
||||
// level of brightness.
|
||||
hsl.L = (double)Max/255;
|
||||
|
||||
// Saturation
|
||||
if ( Max == 0 ) hsl.S = 0; // Protecting from the impossible operation of division by zero.
|
||||
else hsl.S = (double)Diff/Max; // The logic of Adobe Photoshops is this simple.
|
||||
|
||||
// Hue R is situated at the angel of 360 eller noll degrees;
|
||||
// G vid 120 degrees
|
||||
// B vid 240 degrees
|
||||
double q;
|
||||
if ( Diff == 0 ) q = 0; // Protecting from the impossible operation of division by zero.
|
||||
else q = (double)60/Diff;
|
||||
|
||||
if ( Max == c.R )
|
||||
{
|
||||
if ( c.G < c.B ) hsl.H = (double)(360 + q * (c.G - c.B))/360;
|
||||
else hsl.H = (double)(q * (c.G - c.B))/360;
|
||||
}
|
||||
else if ( Max == c.G ) hsl.H = (double)(120 + q * (c.B - c.R))/360;
|
||||
else if ( Max == c.B ) hsl.H = (double)(240 + q * (c.R - c.G))/360;
|
||||
else hsl.H = 0.0;
|
||||
|
||||
return hsl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Custom rounding function.
|
||||
/// </summary>
|
||||
/// <param name="val">Value to round</param>
|
||||
/// <returns>Rounded value</returns>
|
||||
private static int Round(double val)
|
||||
{
|
||||
int ret_val = (int)val;
|
||||
|
||||
int temp = (int)(val * 100);
|
||||
|
||||
if ( (temp % 100) >= 50 )
|
||||
ret_val += 1;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class HSL
|
||||
{
|
||||
#region Class Variables
|
||||
|
||||
public HSL()
|
||||
{
|
||||
_h=0;
|
||||
_s=0;
|
||||
_l=0;
|
||||
}
|
||||
|
||||
double _h;
|
||||
double _s;
|
||||
double _l;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public double H
|
||||
{
|
||||
get{return _h;}
|
||||
set
|
||||
{
|
||||
_h=value;
|
||||
_h=_h>1 ? 1 : _h<0 ? 0 : _h;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public double S
|
||||
{
|
||||
get{return _s;}
|
||||
set
|
||||
{
|
||||
_s=value;
|
||||
_s=_s>1 ? 1 : _s<0 ? 0 : _s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public double L
|
||||
{
|
||||
get{return _l;}
|
||||
set
|
||||
{
|
||||
_l=value;
|
||||
_l=_l>1 ? 1 : _l<0 ? 0 : _l;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// 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("Joy-Con Toolkit Color Picker Library")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("CTCaer Designs S.A.")]
|
||||
[assembly: AssemblyProduct("Joy-Con Color Picker")]
|
||||
[assembly: AssemblyCopyright("CTCaer ©")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.6.2.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -0,0 +1,152 @@
|
||||
// Original code from
|
||||
// Color Picker with Color Wheel and Eye Dropper
|
||||
// by jkristia
|
||||
//
|
||||
// Modified by:
|
||||
// CTCaer | Feb 2018.
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor {
|
||||
class EyedropColorPicker : Control
|
||||
{
|
||||
public event EventHandler SelectedColorChanged;
|
||||
|
||||
Bitmap m_snapshot;
|
||||
Bitmap m_icon;
|
||||
Color m_selectedColor;
|
||||
float m_zoom = 4;
|
||||
public int Zoom
|
||||
{
|
||||
get { return (int)m_zoom; }
|
||||
set
|
||||
{
|
||||
m_zoom = value;
|
||||
RecalcSnapshotSize();
|
||||
}
|
||||
}
|
||||
public Color SelectedColor
|
||||
{
|
||||
get { return m_selectedColor; }
|
||||
set
|
||||
{
|
||||
if (m_selectedColor == value)
|
||||
return;
|
||||
}
|
||||
}
|
||||
public EyedropColorPicker()
|
||||
{
|
||||
this.DoubleBuffered = true;
|
||||
m_icon = new Bitmap(jcColor.Properties.Resources.eyedropper);
|
||||
m_icon.MakeTransparent(Color.Magenta);
|
||||
}
|
||||
RectangleF ImageRect
|
||||
{
|
||||
get
|
||||
{
|
||||
return Util.Rect(ClientRectangle);
|
||||
}
|
||||
}
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
RecalcSnapshotSize();
|
||||
}
|
||||
void RecalcSnapshotSize()
|
||||
{
|
||||
if (m_snapshot != null)
|
||||
m_snapshot.Dispose();
|
||||
RectangleF r = ImageRect;
|
||||
int w = (int)(Math.Floor(r.Width / Zoom));
|
||||
int h = (int)(Math.Floor(r.Height / Zoom));
|
||||
m_snapshot = new Bitmap(w, h);
|
||||
}
|
||||
void GetSnapshot()
|
||||
{
|
||||
Point p = Control.MousePosition;
|
||||
p.X -= m_snapshot.Width / 2;
|
||||
p.Y -= m_snapshot.Height / 2;
|
||||
|
||||
using (Graphics dc = Graphics.FromImage(m_snapshot))
|
||||
{
|
||||
dc.CopyFromScreen(p, new Point(0,0), m_snapshot.Size);
|
||||
Refresh(); //Invalidate();
|
||||
|
||||
PointF center = Util.Center(new RectangleF(0, 0, m_snapshot.Size.Width, m_snapshot.Size.Height));
|
||||
Color c = m_snapshot.GetPixel((int)Math.Round(center.X), (int)Math.Round(center.Y));
|
||||
if (c != m_selectedColor)
|
||||
{
|
||||
m_selectedColor = c;
|
||||
if (SelectedColorChanged != null)
|
||||
SelectedColorChanged(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
Rectangle rr = ClientRectangle;
|
||||
|
||||
if (m_snapshot != null)
|
||||
{
|
||||
e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
RectangleF r = RectangleF.Empty;
|
||||
r.Width = m_snapshot.Size.Width * Zoom;
|
||||
r.Height = m_snapshot.Size.Height * Zoom;
|
||||
r.X = 0;
|
||||
r.Y = 0;
|
||||
e.Graphics.DrawImage(m_snapshot, r);
|
||||
|
||||
if (iscapturing)
|
||||
{
|
||||
PointF center = Util.Center(r);
|
||||
Rectangle centerrect = new Rectangle(Util.Point(center), new Size(0, 0));
|
||||
centerrect.X -= ((int)Zoom / 2 - 1);
|
||||
centerrect.Y -= ((int)Zoom / 2 - 1);
|
||||
centerrect.Width = (int)Zoom;
|
||||
centerrect.Height = (int)Zoom;
|
||||
e.Graphics.DrawRectangle(Pens.Black, centerrect);
|
||||
}
|
||||
else
|
||||
{
|
||||
int offset = 3;
|
||||
e.Graphics.FillRectangle(SystemBrushes.Control, new Rectangle(new Point(offset,offset), m_icon.Size));
|
||||
e.Graphics.DrawImage(m_icon, offset, offset);
|
||||
}
|
||||
}
|
||||
Pen pen = new Pen(BackColor, 3);
|
||||
rr.Inflate(-1,-1);
|
||||
e.Graphics.DrawRectangle(pen, rr);
|
||||
Util.DrawFrame(e.Graphics, rr, 6, Color.CadetBlue);
|
||||
}
|
||||
bool iscapturing = false;
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
if ((e.Button & MouseButtons.Left)== MouseButtons.Left)
|
||||
{
|
||||
Cursor = Cursors.Cross;
|
||||
iscapturing = true;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if ((e.Button & MouseButtons.Left)== MouseButtons.Left)
|
||||
GetSnapshot();
|
||||
}
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
{
|
||||
Cursor = Cursors.Arrow;
|
||||
iscapturing = false;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
namespace jcColor
|
||||
{
|
||||
partial class PresetNameDialog
|
||||
{
|
||||
/// <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.txtbox_presetName = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.m_btn_OK = new System.Windows.Forms.Button();
|
||||
this.m_btn_Cancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtbox_presetName
|
||||
//
|
||||
this.txtbox_presetName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.txtbox_presetName.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtbox_presetName.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtbox_presetName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
|
||||
this.txtbox_presetName.Location = new System.Drawing.Point(12, 45);
|
||||
this.txtbox_presetName.Name = "txtbox_presetName";
|
||||
this.txtbox_presetName.Size = new System.Drawing.Size(245, 20);
|
||||
this.txtbox_presetName.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251)))));
|
||||
this.label1.Location = new System.Drawing.Point(9, 19);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(131, 17);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Enter preset\'s name:";
|
||||
//
|
||||
// m_btn_OK
|
||||
//
|
||||
this.m_btn_OK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.m_btn_OK.FlatAppearance.BorderSize = 0;
|
||||
this.m_btn_OK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.m_btn_OK.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(161)));
|
||||
this.m_btn_OK.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(188)))), ((int)(((byte)(0)))));
|
||||
this.m_btn_OK.Location = new System.Drawing.Point(170, 81);
|
||||
this.m_btn_OK.Name = "m_btn_OK";
|
||||
this.m_btn_OK.Size = new System.Drawing.Size(87, 30);
|
||||
this.m_btn_OK.TabIndex = 5;
|
||||
this.m_btn_OK.Text = "OK";
|
||||
this.m_btn_OK.UseVisualStyleBackColor = false;
|
||||
this.m_btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
|
||||
//
|
||||
// m_btn_Cancel
|
||||
//
|
||||
this.m_btn_Cancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(85)))), ((int)(((byte)(85)))));
|
||||
this.m_btn_Cancel.FlatAppearance.BorderSize = 0;
|
||||
this.m_btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.m_btn_Cancel.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(161)));
|
||||
this.m_btn_Cancel.ForeColor = System.Drawing.Color.OrangeRed;
|
||||
this.m_btn_Cancel.Location = new System.Drawing.Point(68, 81);
|
||||
this.m_btn_Cancel.Name = "m_btn_Cancel";
|
||||
this.m_btn_Cancel.Size = new System.Drawing.Size(87, 30);
|
||||
this.m_btn_Cancel.TabIndex = 6;
|
||||
this.m_btn_Cancel.Text = "Cancel";
|
||||
this.m_btn_Cancel.UseVisualStyleBackColor = false;
|
||||
this.m_btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
|
||||
//
|
||||
// PresetNameDialog
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
|
||||
this.ClientSize = new System.Drawing.Size(267, 125);
|
||||
this.Controls.Add(this.m_btn_Cancel);
|
||||
this.Controls.Add(this.m_btn_OK);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.txtbox_presetName);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "PresetNameDialog";
|
||||
this.ShowIcon = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Update Preset";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
public System.Windows.Forms.TextBox txtbox_presetName;
|
||||
private System.Windows.Forms.Label label1;
|
||||
public System.Windows.Forms.Button m_btn_OK;
|
||||
public System.Windows.Forms.Button m_btn_Cancel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor
|
||||
{
|
||||
public partial class PresetNameDialog : Form
|
||||
{
|
||||
public PresetNameDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.AcceptButton = this.m_btn_OK;
|
||||
}
|
||||
|
||||
private void btn_OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btn_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace jcColor.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("jcColor.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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap eyedropper {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("eyedropper", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="eyedropper" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\eyedropper.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,312 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
internal class resfinder
|
||||
{
|
||||
// Trick from Bob Powell
|
||||
}
|
||||
|
||||
namespace jcColor.Buttons
|
||||
{
|
||||
[Description("Round (Elliptical) Button Control")]
|
||||
public class RoundButton : System.Windows.Forms.Button
|
||||
{
|
||||
#region Public Properties
|
||||
public override string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return buttonText;
|
||||
}
|
||||
set
|
||||
{
|
||||
buttonText = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool checkedFocus;
|
||||
[Bindable(true), Category("Button Appearance"),
|
||||
DefaultValue(false),
|
||||
Description("Specifies if the button is checked.")]
|
||||
public bool CheckedFocus {
|
||||
get {
|
||||
return checkedFocus;
|
||||
}
|
||||
set {
|
||||
checkedFocus = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public int buttonPressOffset;
|
||||
[Bindable(true), Category("Button Appearance"),
|
||||
DefaultValue(0),
|
||||
Description("Specifies if the button is pressed.")]
|
||||
public int ButtonPressOffset {
|
||||
get {
|
||||
return buttonPressOffset;
|
||||
}
|
||||
set {
|
||||
buttonPressOffset = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Windows form control derived from Button, to create round and elliptical buttons
|
||||
/// </summary>
|
||||
public RoundButton()
|
||||
{
|
||||
this.Name = "RoundButton";
|
||||
this.Size = new System.Drawing.Size(50, 50); // Default size of control
|
||||
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mouseDown);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.mouseUp);
|
||||
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.keyDown);
|
||||
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.keyUp);
|
||||
}
|
||||
|
||||
#region Private properties
|
||||
|
||||
private Color buttonColor;
|
||||
private String buttonText;
|
||||
|
||||
private Color edgeColor1; // Change if button pressed
|
||||
private Color edgeColor2; //
|
||||
private int edgeWidth; // Width of button edge
|
||||
private Color cColor = Color.White; // Centre colour for Path Gradient brushed
|
||||
|
||||
private GraphicsPath bpath;
|
||||
private GraphicsPath gpath;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Base draw functions
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
buttonColor = this.BackColor;
|
||||
edgeColor1 = ControlPaint.Light(buttonColor);
|
||||
edgeColor2 = ControlPaint.Dark(buttonColor);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
Rectangle buttonRect = this.ClientRectangle;
|
||||
edgeWidth = GetEdgeWidth(buttonRect);
|
||||
|
||||
FillBackground(g, buttonRect);
|
||||
|
||||
ShrinkShape(ref g, ref buttonRect, edgeWidth);
|
||||
|
||||
DrawButton(g, buttonRect);
|
||||
|
||||
SetClickableRegion();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill in the control background
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics object</param>
|
||||
/// <param name="rect">Rectangle defining the button background</param>
|
||||
protected void FillBackground(Graphics g, Rectangle rect)
|
||||
{
|
||||
// Fill in the control with the background colour, to overwrite anything
|
||||
// that may have been drawn already.
|
||||
Rectangle bgRect = rect;
|
||||
bgRect.Inflate(1,1);
|
||||
SolidBrush bgBrush = new SolidBrush(Color.FromKnownColor(KnownColor.Control));
|
||||
bgBrush.Color = Parent.BackColor;
|
||||
g.FillRectangle(bgBrush, bgRect);
|
||||
bgBrush.Dispose();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill in the main button colour
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="buttonRect">Rectangle defining the button top</param>
|
||||
protected virtual void DrawButton(Graphics g, Rectangle buttonRect)
|
||||
{
|
||||
BuildGraphicsPath(buttonRect);
|
||||
|
||||
PathGradientBrush pgb = new PathGradientBrush(bpath);
|
||||
pgb.SurroundColors = new Color[] {buttonColor};
|
||||
|
||||
buttonRect.Offset(buttonPressOffset, buttonPressOffset);
|
||||
|
||||
pgb.CenterColor = buttonColor;
|
||||
|
||||
FillShape(g, pgb, buttonRect);
|
||||
|
||||
// If we have focus, draw line around control to indicate this.
|
||||
if (CheckedFocus)
|
||||
{
|
||||
DrawFocus(g, buttonRect);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Base draw functions
|
||||
|
||||
#region Overrideable shape-specific methods
|
||||
|
||||
protected virtual void BuildGraphicsPath(Rectangle buttonRect)
|
||||
{
|
||||
bpath = new GraphicsPath();
|
||||
// Adding this second smaller rectangle to the graphics path smooths the edges - don't know why...?
|
||||
Rectangle rect2 = new Rectangle(buttonRect.X - 1, buttonRect.Y - 1, buttonRect.Width + 2, buttonRect.Height + 2);
|
||||
AddShape(bpath, rect2);
|
||||
AddShape(bpath, buttonRect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create region the same shape as the button. This will respond to the mouse click
|
||||
/// </summary>
|
||||
protected virtual void SetClickableRegion()
|
||||
{
|
||||
gpath = new GraphicsPath();
|
||||
gpath.AddEllipse(this.ClientRectangle);
|
||||
this.Region = new Region(gpath); // Click only activates on elipse
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method to fill the specified rectangle with either LinearGradient or PathGradient
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="brush">Either a PathGradient- or LinearGradientBrush</param>
|
||||
/// <param name="rect">The rectangle bounding the ellipse to be filled</param>
|
||||
protected virtual void FillShape(Graphics g, Object brush, Rectangle rect)
|
||||
{
|
||||
if (brush.GetType().ToString() == "System.Drawing.Drawing2D.LinearGradientBrush")
|
||||
{
|
||||
g.FillEllipse((LinearGradientBrush)brush, rect);
|
||||
}
|
||||
else if (brush.GetType().ToString() == "System.Drawing.Drawing2D.PathGradientBrush")
|
||||
{
|
||||
g.FillEllipse((PathGradientBrush)brush, rect);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add an ellipse to the Graphics Path
|
||||
/// </summary>
|
||||
/// <param name="gpath">The Graphics Path</param>
|
||||
/// <param name="rect">The rectangle defining the ellipse to be added</param>
|
||||
protected virtual void AddShape(GraphicsPath gpath, Rectangle rect)
|
||||
{
|
||||
gpath.AddEllipse(rect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the specified shape
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="pen">Pen</param>
|
||||
/// <param name="rect">The rectangle bounding the ellipse to be drawn</param>
|
||||
protected virtual void DrawShape(Graphics g, Pen pen, Rectangle rect)
|
||||
{
|
||||
g.DrawEllipse(pen, rect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shrink the shape
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="rect">The rectangle defining the shape to be shrunk</param>
|
||||
/// <param name="amount">The amount to shrink it by</param>
|
||||
protected virtual void ShrinkShape(ref Graphics g, ref Rectangle rect, int amount)
|
||||
{
|
||||
rect.Inflate(-amount, -amount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicate that this button has focus
|
||||
/// </summary>
|
||||
/// <param name="g">Graphics Object</param>
|
||||
/// <param name="rect">The rectangle defining the button face</param>
|
||||
protected virtual void DrawFocus(Graphics g, Rectangle rect)
|
||||
{
|
||||
rect.Inflate(-3, -3);
|
||||
Pen fPen = new Pen(Color.FromArgb(150, 255, 255, 255));
|
||||
fPen.DashStyle = DashStyle.Solid;
|
||||
fPen.Width = 2;
|
||||
DrawShape(g, fPen, rect);
|
||||
rect.Inflate(2, 2);
|
||||
fPen = new Pen(Color.FromArgb(150, 0, 0, 0));
|
||||
fPen.DashStyle = DashStyle.Solid;
|
||||
fPen.Width = 3;
|
||||
DrawShape(g, fPen, rect);
|
||||
}
|
||||
|
||||
#endregion Overrideable shape-specific methods
|
||||
|
||||
#region Help functions
|
||||
|
||||
/// <summary>
|
||||
/// Calculate button edge width depending on button size
|
||||
/// </summary>
|
||||
/// <param name="rect">Rectangle defining the button</param>
|
||||
/// <returns>The width of the edge</returns>
|
||||
protected int GetEdgeWidth(Rectangle rect)
|
||||
{
|
||||
if (rect.Width < 50 | rect.Height < 50) return 1;
|
||||
else return 2;
|
||||
}
|
||||
|
||||
#endregion Private Help functions
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
protected void mouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
buttonDown();
|
||||
}
|
||||
|
||||
protected void mouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
buttonUp();
|
||||
}
|
||||
|
||||
protected void buttonDown()
|
||||
{
|
||||
buttonPressOffset = 1;
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
protected void buttonUp()
|
||||
{
|
||||
buttonPressOffset = 0;
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
protected void keyDown(object sender, System.Windows.Forms.KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode.ToString() == "Space")
|
||||
{
|
||||
buttonDown();
|
||||
}
|
||||
}
|
||||
|
||||
protected void keyUp(object sender, System.Windows.Forms.KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode.ToString() == "Space")
|
||||
{
|
||||
buttonUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion Event Handlers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,329 @@
|
||||
// Original code from
|
||||
// Color Picker with Color Wheel and Eye Dropper
|
||||
// by jkristia
|
||||
//
|
||||
// Modified by:
|
||||
// CTCaer | Feb 2018.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace jcColor {
|
||||
static class Util
|
||||
{
|
||||
public static Rectangle Rect(RectangleF rf)
|
||||
{
|
||||
Rectangle r = new Rectangle();
|
||||
r.X = (int)rf.X;
|
||||
r.Y = (int)rf.Y;
|
||||
r.Width = (int)rf.Width;
|
||||
r.Height = (int)rf.Height;
|
||||
return r;
|
||||
}
|
||||
public static RectangleF Rect(Rectangle r)
|
||||
{
|
||||
RectangleF rf = new RectangleF();
|
||||
rf.X = (float)r.X;
|
||||
rf.Y = (float)r.Y;
|
||||
rf.Width = (float)r.Width;
|
||||
rf.Height = (float)r.Height;
|
||||
return rf;
|
||||
}
|
||||
public static Point Point(PointF pf)
|
||||
{
|
||||
return new Point((int)pf.X, (int)pf.Y);
|
||||
}
|
||||
public static PointF Center(RectangleF r)
|
||||
{
|
||||
PointF center = r.Location;
|
||||
center.X += r.Width / 2;
|
||||
center.Y += r.Height / 2;
|
||||
return center;
|
||||
}
|
||||
|
||||
public static void DrawFrame(Graphics dc, RectangleF r, float cornerRadius, Color color)
|
||||
{
|
||||
Pen pen = new Pen(color);
|
||||
if (cornerRadius <= 0)
|
||||
{
|
||||
dc.DrawRectangle(pen, Rect(r));
|
||||
return;
|
||||
}
|
||||
cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Width) - 2);
|
||||
cornerRadius = (float)Math.Min(cornerRadius, Math.Floor(r.Height) - 2);
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddArc(r.X,r.Y, cornerRadius, cornerRadius, 180, 90);
|
||||
path.AddArc(r.Right-cornerRadius,r.Y, cornerRadius, cornerRadius, 270, 90);
|
||||
path.AddArc(r.Right-cornerRadius,r.Bottom-cornerRadius, cornerRadius, cornerRadius, 0, 90);
|
||||
path.AddArc(r.X,r.Bottom-cornerRadius, cornerRadius, cornerRadius, 90, 90);
|
||||
path.CloseAllFigures();
|
||||
dc.DrawPath(pen, path);
|
||||
}
|
||||
public static void Draw2ColorBar(Graphics dc, RectangleF r, Orientation orientation, Color c1, Color c2)
|
||||
{
|
||||
RectangleF lr1 = r;
|
||||
float angle = 0;
|
||||
|
||||
if (orientation == Orientation.Vertical)
|
||||
angle = 270;
|
||||
if (orientation == Orientation.Horizontal)
|
||||
angle = 0;
|
||||
|
||||
if (lr1.Height > 0 && lr1.Width > 0)
|
||||
{
|
||||
LinearGradientBrush lb1 = new LinearGradientBrush(lr1, c1, c2, angle, false);
|
||||
dc.FillRectangle(lb1, lr1);
|
||||
lb1.Dispose();
|
||||
}
|
||||
}
|
||||
public static void Draw3ColorBar(Graphics dc, RectangleF r, Orientation orientation, Color c1, Color c2, Color c3)
|
||||
{
|
||||
// to draw a 3 color bar 2 gradient brushes are needed
|
||||
// one from c1 - c2 and c2 - c3
|
||||
RectangleF lr1 = r;
|
||||
RectangleF lr2 = r;
|
||||
float angle = 0;
|
||||
|
||||
if (orientation == Orientation.Vertical)
|
||||
{
|
||||
angle = 270;
|
||||
|
||||
lr1.Height = lr1.Height / 2;
|
||||
lr2.Height = r.Height - lr1.Height;
|
||||
lr2.Y += lr1.Height;
|
||||
}
|
||||
if (orientation == Orientation.Horizontal)
|
||||
{
|
||||
angle = 0;
|
||||
|
||||
lr1.Width = lr1.Width / 2;
|
||||
lr2.Width = r.Width - lr1.Width;
|
||||
lr1.X = lr2.Right;
|
||||
}
|
||||
|
||||
if (lr1.Height > 0 && lr1.Width > 0)
|
||||
{
|
||||
LinearGradientBrush lb2 = new LinearGradientBrush(lr2, c1, c2, angle, false);
|
||||
LinearGradientBrush lb1 = new LinearGradientBrush(lr1, c2, c3, angle, false);
|
||||
|
||||
dc.FillRectangle(lb1, lr1);
|
||||
dc.FillRectangle(lb2, lr2);
|
||||
|
||||
lb1.Dispose();
|
||||
lb2.Dispose();
|
||||
}
|
||||
// with some sizes the first pixel in the gradient rectangle shows the opposite color
|
||||
// this is a workaround for that problem
|
||||
if (orientation == Orientation.Vertical)
|
||||
{
|
||||
Pen pc2 = new Pen(c2, 1);
|
||||
Pen pc3 = new Pen(c3, 1);
|
||||
dc.DrawLine(pc3, lr1.Left, lr1.Top, lr1.Right - 1, lr1.Top);
|
||||
dc.DrawLine(pc2, lr2.Left, lr2.Top, lr2.Right - 1, lr2.Top);
|
||||
pc2.Dispose();
|
||||
pc3.Dispose();
|
||||
}
|
||||
|
||||
if (orientation == Orientation.Horizontal)
|
||||
{
|
||||
Pen pc1 = new Pen(c1, 1);
|
||||
Pen pc2 = new Pen(c2, 1);
|
||||
Pen pc3 = new Pen(c3, 1);
|
||||
dc.DrawLine(pc1, lr2.Left, lr2.Top, lr2.Left, lr2.Bottom-1);
|
||||
dc.DrawLine(pc2, lr2.Right, lr2.Top, lr2.Right, lr2.Bottom-1);
|
||||
dc.DrawLine(pc3, lr1.Right, lr1.Top, lr1.Right, lr1.Bottom-1);
|
||||
pc1.Dispose();
|
||||
pc2.Dispose();
|
||||
pc3.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Control> controlsSorted(this Control panel) {
|
||||
var controls = panel.Controls.OfType<Control>().ToList();
|
||||
controls.Sort((c1, c2) => c1.TabIndex.CompareTo(c2.TabIndex));
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
|
||||
class WinUtil
|
||||
{
|
||||
public const int WM_KEYDOWN = 0x0100;
|
||||
public const int WM_KEYUP = 0x0101;
|
||||
public const int WM_CHAR = 0x0102;
|
||||
|
||||
public const int SWP_NOSIZE = 0x0001;
|
||||
public const int SWP_NOMOVE = 0x0002;
|
||||
public const int SWP_NOZORDER = 0x0004;
|
||||
public const int SWP_NOREDRAW = 0x0008;
|
||||
public const int SWP_NOACTIVATE = 0x0010;
|
||||
public const int SWP_FRAMECHANGED = 0x0020; /* The frame changed: send WM_NCCALCSIZE */
|
||||
public const int SWP_SHOWWINDOW = 0x0040;
|
||||
public const int SWP_HIDEWINDOW = 0x0080;
|
||||
public const int SWP_NOCOPYBITS = 0x0100;
|
||||
public const int SWP_NOOWNERZORDER = 0x0200; /* Don't do owner Z ordering */
|
||||
public const int SWP_NOSENDCHANGING = 0x0400; /* Don't send WM_WINDOWPOSCHANGING */
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||||
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags);
|
||||
|
||||
public const uint WS_OVERLAPPED = WS_BORDER | WS_CAPTION;
|
||||
public const uint WS_CLIPSIBLINGS = 0x04000000;
|
||||
public const uint WS_CLIPCHILDREN = 0x02000000;
|
||||
public const uint WS_CAPTION = 0x00C00000; /* WS_BORDER | WS_DLGFRAME */
|
||||
public const uint WS_BORDER = 0x00800000;
|
||||
public const uint WS_DLGFRAME = 0x00400000;
|
||||
public const uint WS_VSCROLL = 0x00200000;
|
||||
public const uint WS_HSCROLL = 0x00100000;
|
||||
public const uint WS_SYSMENU = 0x00080000;
|
||||
public const uint WS_THICKFRAME = 0x00040000;
|
||||
public const uint WS_MAXIMIZEBOX = 0x00020000;
|
||||
public const uint WS_MINIMIZEBOX = 0x00010000;
|
||||
public const uint WS_SIZEBOX = WS_THICKFRAME;
|
||||
public const uint WS_POPUP = 0x80000000;
|
||||
public const uint WS_CHILD = 0x40000000;
|
||||
public const uint WS_VISIBLE = 0x10000000;
|
||||
public const uint WS_DISABLED = 0x08000000;
|
||||
|
||||
public const uint WS_EX_DLGMODALFRAME= 0x00000001;
|
||||
public const uint WS_EX_TOPMOST = 0x00000008;
|
||||
public const uint WS_EX_TOOLWINDOW = 0x00000080;
|
||||
public const uint WS_EX_WINDOWEDGE = 0x00000100;
|
||||
public const uint WS_EX_CLIENTEDGE = 0x00000200;
|
||||
|
||||
public const uint WS_EX_CONTEXTHELP = 0x00000400;
|
||||
public const uint WS_EX_STATICEDGE = 0x00020000;
|
||||
public const uint WS_EX_OVERLAPPEDWINDOW =(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
|
||||
|
||||
public const int GWL_STYLE = (-16);
|
||||
public const int GWL_EXSTYLE = (-20);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint="GetWindowLong", CharSet=CharSet.Auto)]
|
||||
public static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint="SetWindowLong", CharSet=CharSet.Auto)]
|
||||
public static extern IntPtr SetWindowLongPtr32(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
|
||||
public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
public const int WH_KEYBOARD = 2;
|
||||
public const int WH_MOUSE = 7;
|
||||
public const int WH_KEYBOARD_LL = 13;
|
||||
public const int WH_MOUSE_LL = 14;
|
||||
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
|
||||
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern bool UnhookWindowsHookEx(int idHook);
|
||||
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto,CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
//Declare the wrapper managed POINT class.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class POINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
|
||||
//Declare the wrapper managed MouseHookStruct class.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class MouseHookStruct
|
||||
{
|
||||
public POINT pt;
|
||||
public int hwnd;
|
||||
public int wHitTestCode;
|
||||
public int dwExtraInfo;
|
||||
}
|
||||
|
||||
//Declare the wrapper managed KeyboardHookStruct class.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class KeyboardHookStruct
|
||||
{
|
||||
public int vkCode;
|
||||
public int scanCode;
|
||||
public int flags;
|
||||
public int time;
|
||||
public int dwExtraInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// http://support.microsoft.com/kb/318804
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp
|
||||
/// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookstructures/cwpstruct.asp
|
||||
/// http://www.codeproject.com/KB/cs/globalhook.aspx
|
||||
public class Hook
|
||||
{
|
||||
public delegate void KeyboardDelegate(KeyEventArgs e);
|
||||
public KeyboardDelegate OnKeyDown;
|
||||
int m_hHook = 0;
|
||||
WinUtil.HookProc m_HookCallback;
|
||||
|
||||
public void SetHook(bool enable)
|
||||
{
|
||||
if (enable && m_hHook == 0)
|
||||
{
|
||||
m_HookCallback = new WinUtil.HookProc(HookCallbackProc);
|
||||
Module module = Assembly.GetExecutingAssembly().GetModules()[0];
|
||||
m_hHook = WinUtil.SetWindowsHookEx(WinUtil.WH_KEYBOARD_LL, m_HookCallback, Marshal.GetHINSTANCE(module),0);
|
||||
if (m_hHook == 0)
|
||||
{
|
||||
MessageBox.Show("SetHook Failed. Please make sure the 'Visual Studio Host Process' on the debug setting page is disabled");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable == false && m_hHook != 0)
|
||||
{
|
||||
WinUtil.UnhookWindowsHookEx(m_hHook);
|
||||
m_hHook = 0;
|
||||
}
|
||||
}
|
||||
int HookCallbackProc(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
if (nCode < 0)
|
||||
{
|
||||
return WinUtil.CallNextHookEx(m_hHook, nCode, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Marshall the data from the callback.
|
||||
WinUtil.KeyboardHookStruct hookstruct = (WinUtil.KeyboardHookStruct)Marshal.PtrToStructure(lParam, typeof(WinUtil.KeyboardHookStruct));
|
||||
|
||||
if (OnKeyDown != null && wParam.ToInt32() == WinUtil.WM_KEYDOWN)
|
||||
{
|
||||
Keys key = (Keys)hookstruct.vkCode;
|
||||
if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
|
||||
key |= Keys.Shift;
|
||||
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
|
||||
key |= Keys.Control;
|
||||
|
||||
KeyEventArgs e = new KeyEventArgs(key);
|
||||
e.Handled = false;
|
||||
OnKeyDown(e);
|
||||
if (e.Handled)
|
||||
return 1;
|
||||
}
|
||||
int result = 0;
|
||||
if (m_hHook != 0)
|
||||
result = WinUtil.CallNextHookEx(m_hHook, nCode, wParam, lParam);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>
|
||||
@@ -0,0 +1,882 @@
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** Project: Joy-Con Color Picker *****/
|
||||
/***** Filename: ctrl2DColorBox.cs *****/
|
||||
/***** Original Project: Adobe Color Picker Clone 1 *****/
|
||||
/***** Original Author: Danny Blanchard *****/
|
||||
/***** - scrabcakes@gmail.com *****/
|
||||
/***** Updates: *****/
|
||||
/***** 3/28/2005 - Initial Version : Danny Blanchard *****/
|
||||
/***** Feb 2018 - JoyCon Version : CTCaer *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** This version is heavily optimised for use in *****/
|
||||
/***** CTCaer's Joy-Con Toolkit and other projects. *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor {
|
||||
/// <summary>
|
||||
/// Summary description for ctrl2DColorBox.
|
||||
/// </summary>
|
||||
public class ctrl2DColorBox : System.Windows.Forms.UserControl
|
||||
{
|
||||
#region Class Variables
|
||||
|
||||
public enum eDrawStyle
|
||||
{
|
||||
Hue,
|
||||
Saturation,
|
||||
Brightness,
|
||||
Red,
|
||||
Green,
|
||||
Blue
|
||||
}
|
||||
|
||||
private int m_iMarker_X = 0;
|
||||
private int m_iMarker_Y = 0;
|
||||
private bool m_bDragging = false;
|
||||
|
||||
// These variables keep track of how to fill in the content inside the box;
|
||||
private eDrawStyle m_eDrawStyle = eDrawStyle.Hue;
|
||||
private AdobeColors.HSL m_hsl;
|
||||
private Color m_rgb;
|
||||
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors / Destructors
|
||||
|
||||
public ctrl2DColorBox()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
// Initialize Colors
|
||||
m_hsl = new AdobeColors.HSL();
|
||||
m_hsl.H = 1.0;
|
||||
m_hsl.S = 1.0;
|
||||
m_hsl.L = 1.0;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
m_eDrawStyle = eDrawStyle.Hue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Component 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.SuspendLayout();
|
||||
//
|
||||
// ctrl2DColorBox
|
||||
//
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
|
||||
this.ForeColor = System.Drawing.Color.DeepSkyBlue;
|
||||
this.Name = "ctrl2DColorBox";
|
||||
this.Size = new System.Drawing.Size(260, 260);
|
||||
this.Load += new System.EventHandler(this.ctrl2DColorBox_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ctrl2DColorBox_Paint);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ctrl2DColorBox_MouseDown);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrl2DColorBox_MouseMove);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ctrl2DColorBox_MouseUp);
|
||||
this.Resize += new System.EventHandler(this.ctrl2DColorBox_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Control Events
|
||||
|
||||
private void ctrl2DColorBox_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
m_bDragging = true; // Begin dragging which notifies MouseMove function that it needs to update the marker
|
||||
|
||||
int x = e.X - 2, y = e.Y - 2;
|
||||
if ( x < 0 ) x = 0;
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // Calculate marker position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4;
|
||||
|
||||
if ( x == m_iMarker_X && y == m_iMarker_Y ) // If the marker hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawMarker(x, y, true); // Redraw the marker
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls marker (selected color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( !m_bDragging ) // Only respond when the mouse is dragging the marker.
|
||||
return;
|
||||
|
||||
int x = e.X - 2, y = e.Y - 2;
|
||||
if ( x < 0 ) x = 0;
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // Calculate marker position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4;
|
||||
|
||||
if ( x == m_iMarker_X && y == m_iMarker_Y ) // If the marker hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawMarker(x, y, true); // Redraw the marker
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls marker (selected color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
if ( !m_bDragging )
|
||||
return;
|
||||
|
||||
m_bDragging = false;
|
||||
|
||||
int x = e.X - 2, y = e.Y - 2;
|
||||
if ( x < 0 ) x = 0;
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // Calculate marker position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4;
|
||||
|
||||
if ( x == m_iMarker_X && y == m_iMarker_Y ) // If the marker hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawMarker(x, y, true); // Redraw the marker
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls marker (selected color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl2DColorBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public new event EventHandler Scroll;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// The drawstyle of the contol (Hue, Saturation, Brightness, Red, Green or Blue)
|
||||
/// </summary>
|
||||
public eDrawStyle DrawStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_eDrawStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_eDrawStyle = value;
|
||||
|
||||
// Redraw the control based on the new eDrawStyle
|
||||
Reset_Marker(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The HSL color of the control, changing the HSL will automatically change the RGB color for the control.
|
||||
/// </summary>
|
||||
public AdobeColors.HSL HSL
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_hsl;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_hsl = value;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Marker(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The RGB color of the control, changing the RGB will automatically change the HSL color for the control.
|
||||
/// </summary>
|
||||
public Color RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rgb;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rgb = value;
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Marker(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Redraws only the content over the marker
|
||||
/// </summary>
|
||||
private void ClearMarker()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
// Determine the area that needs to be redrawn
|
||||
int start_x, start_y, end_x, end_y;
|
||||
int red = 0; int green = 0; int blue = 0;
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
|
||||
// Find the markers corners
|
||||
start_x = m_iMarker_X - 5;
|
||||
start_y = m_iMarker_Y - 5;
|
||||
end_x = m_iMarker_X + 5;
|
||||
end_y = m_iMarker_Y + 5;
|
||||
// Adjust the area if part of it hangs outside the content area
|
||||
if ( start_x < 0 ) start_x = 0;
|
||||
if ( start_y < 0 ) start_y = 0;
|
||||
if ( end_x > this.Width - 4 ) end_x = this.Width - 4;
|
||||
if ( end_y > this.Height - 4 ) end_y = this.Height - 4;
|
||||
|
||||
// Redraw the content based on the current draw style:
|
||||
// The code get's a little messy from here
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
// S=0,S=1,S=2,S=3.....S=100
|
||||
// L=100
|
||||
// L=99
|
||||
// L=98 Drawstyle
|
||||
// L=97 Hue
|
||||
// ...
|
||||
// L=0
|
||||
case eDrawStyle.Hue :
|
||||
|
||||
hsl_start.H = m_hsl.H; hsl_end.H = m_hsl.H; // Hue is constant
|
||||
hsl_start.S = (double)start_x/(this.Width - 4); // Because we're drawing horizontal lines, s will not change
|
||||
hsl_end.S = (double)end_x/(this.Width - 4); // from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
hsl_start.L = 1.0 - (double)i/(this.Height - 4); // Brightness (L) WILL change for each horizontal
|
||||
hsl_end.L = hsl_start.L; // line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// H=0,H=1,H=2,H=3.....H=360
|
||||
// L=100
|
||||
// L=99
|
||||
// L=98 Drawstyle
|
||||
// L=97 Saturation
|
||||
// ...
|
||||
// L=0
|
||||
case eDrawStyle.Saturation :
|
||||
|
||||
hsl_start.S = m_hsl.S; hsl_end.S = m_hsl.S; // Saturation is constant
|
||||
hsl_start.L = 1.0 - (double)start_y/(this.Height - 4); // Because we're drawing vertical lines, L will
|
||||
hsl_end.L = 1.0 - (double)end_y/(this.Height - 4); // not change from line to line
|
||||
|
||||
for ( int i = start_x; i <= end_x; i++ ) // For each vertical line:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Hue (H) WILL change for each vertical
|
||||
hsl_end.H = hsl_start.H; // line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(i + 2,start_y + 1, 1, end_y - start_y + 2), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, start_y + 2, 1, end_y - start_y + 1));
|
||||
br.Dispose();
|
||||
}
|
||||
break;
|
||||
// H=0,H=1,H=2,H=3.....H=360
|
||||
// S=100
|
||||
// S=99
|
||||
// S=98 Drawstyle
|
||||
// S=97 Brightness
|
||||
// ...
|
||||
// S=0
|
||||
case eDrawStyle.Brightness :
|
||||
|
||||
hsl_start.L = m_hsl.L; hsl_end.L = m_hsl.L; // Luminance is constant
|
||||
hsl_start.S = 1.0 - (double)start_y/(this.Height - 4); // Because we're drawing vertical lines, S will
|
||||
hsl_end.S = 1.0 - (double)end_y/(this.Height - 4); // not change from line to line
|
||||
|
||||
for ( int i = start_x; i <= end_x; i++ ) // For each vertical line:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Hue (H) WILL change for each vertical
|
||||
hsl_end.H = hsl_start.H; // line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(i + 2,start_y + 1, 1, end_y - start_y + 2), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, start_y + 2, 1, end_y - start_y + 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// B=0,B=1,B=2,B=3.....B=100
|
||||
// G=100
|
||||
// G=99
|
||||
// G=98 Drawstyle
|
||||
// G=97 Red
|
||||
// ...
|
||||
// G=0
|
||||
case eDrawStyle.Red :
|
||||
|
||||
red = m_rgb.R; // Red is constant
|
||||
int start_b = Round(255 * (double)start_x/(this.Width - 4)); // Because we're drawing horizontal lines, B
|
||||
int end_b = Round(255 * (double)end_x/(this.Width - 4)); // will not change from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
green = Round(255 - (255 * (double)i/(this.Height - 4))); // green WILL change for each horizontal line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), Color.FromArgb(red, green, start_b), Color.FromArgb(red, green, end_b), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// B=0,B=1,B=2,B=3.....B=100
|
||||
// R=100
|
||||
// R=99
|
||||
// R=98 Drawstyle
|
||||
// R=97 Green
|
||||
// ...
|
||||
// R=0
|
||||
case eDrawStyle.Green :
|
||||
|
||||
green = m_rgb.G;; // Green is constant
|
||||
int start_b2 = Round(255 * (double)start_x/(this.Width - 4)); // Because we're drawing horizontal lines, B
|
||||
int end_b2 = Round(255 * (double)end_x/(this.Width - 4)); // will not change from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
red = Round(255 - (255 * (double)i/(this.Height - 4))); // red WILL change for each horizontal line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), Color.FromArgb(red, green, start_b2), Color.FromArgb(red, green, end_b2), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
// R=0,R=1,R=2,R=3.....R=100
|
||||
// G=100
|
||||
// G=99
|
||||
// G=98 Drawstyle
|
||||
// G=97 Blue
|
||||
// ...
|
||||
// G=0
|
||||
case eDrawStyle.Blue :
|
||||
|
||||
blue = m_rgb.B;; // Blue is constant
|
||||
int start_r = Round(255 * (double)start_x/(this.Width - 4)); // Because we're drawing horizontal lines, R
|
||||
int end_r = Round(255 * (double)end_x/(this.Width - 4)); // will not change from line to line
|
||||
|
||||
for ( int i = start_y; i <= end_y; i++ ) // For each horizontal line:
|
||||
{
|
||||
green = Round(255 - (255 * (double)i/(this.Height - 4))); // green WILL change for each horizontal line drawn
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(start_x + 1,i + 2, end_x - start_x + 1, 1), Color.FromArgb(start_r, green, blue), Color.FromArgb(end_r, green, blue), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(start_x + 2,i + 2, end_x - start_x + 1 , 1));
|
||||
br.Dispose();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the marker (circle) inside the box
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="Unconditional"></param>
|
||||
private void DrawMarker(int x, int y, bool Unconditional) // *****
|
||||
{ // * | *
|
||||
if ( x < 0 ) x = 0; // * | *
|
||||
if ( x > this.Width - 4 ) x = this.Width - 4; // * | *
|
||||
if ( y < 0 ) y = 0; // * | *
|
||||
if ( y > this.Height - 4 ) y = this.Height - 4; // *----X----*
|
||||
// * | *
|
||||
if ( m_iMarker_Y == y && m_iMarker_X == x && !Unconditional ) // * | *
|
||||
return; // * | *
|
||||
// * | *
|
||||
ClearMarker(); // *****
|
||||
|
||||
m_iMarker_X = x;
|
||||
m_iMarker_Y = y;
|
||||
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pen;
|
||||
AdobeColors.HSL _hsl = GetColor(x,y); // The selected color determines the color of the marker drawn over
|
||||
// it (black or white)
|
||||
if ( _hsl.L < (double)200/255 )
|
||||
pen = new Pen(Color.White); // White marker if selected color is dark
|
||||
else if ( _hsl.H < (double)26/360 || _hsl.H > (double)200/360 )
|
||||
if ( _hsl.S > (double)70/255 )
|
||||
pen = new Pen(Color.White);
|
||||
else
|
||||
pen = new Pen(Color.Black); // Else use a black marker for lighter colors
|
||||
else
|
||||
pen = new Pen(Color.Black);
|
||||
|
||||
g.DrawEllipse(pen, x - 3, y - 3, 10, 10); // Draw the marker : 11 x 11 circle
|
||||
|
||||
DrawBorder(); // Force the border to be redrawn, just in case the marker has been drawn over it.
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the border around the control.
|
||||
/// </summary>
|
||||
private void DrawBorder()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pencil;
|
||||
|
||||
// To make the control look like Adobe Photoshop's the border around the control will be a gray line
|
||||
// on the top and left side, a white line on the bottom and right side, and a black rectangle (line)
|
||||
// inside the gray/white rectangle
|
||||
|
||||
pencil = new Pen(Color.FromArgb(100, 100, 100)); // The same gray color used by Photoshop
|
||||
g.DrawLine(pencil, this.Width - 2, 0, 0, 0); // Draw top line
|
||||
g.DrawLine(pencil, 0, 0, 0, this.Height - 2); // Draw left hand line
|
||||
|
||||
//pencil = new Pen(Color.White);
|
||||
g.DrawLine(pencil, this.Width - 1, 0, this.Width - 1,this.Height - 1); // Draw right hand line
|
||||
g.DrawLine(pencil, this.Width - 1,this.Height - 1, 0,this.Height - 1); // Draw bottome line
|
||||
|
||||
pencil = new Pen(Color.FromArgb(85, 85, 85));
|
||||
g.DrawRectangle(pencil, 1, 1, this.Width - 3, this.Height - 3); // Draw inner black rectangle
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the DrawStyle of the control and calls the appropriate
|
||||
/// drawing function for content
|
||||
/// </summary>
|
||||
private void DrawContent()
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Hue value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Hue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
hsl_start.H = m_hsl.H;
|
||||
hsl_end.H = m_hsl.H;
|
||||
hsl_start.S = 0.0;
|
||||
hsl_end.S = 1.0;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
hsl_start.L = 1.0 - (double)i/(this.Height - 4); // Calculate luminance at this line (Hue and Saturation are constant)
|
||||
hsl_end.L = hsl_start.L;
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Saturation value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Saturation()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
hsl_start.S = m_hsl.S;
|
||||
hsl_end.S = m_hsl.S;
|
||||
hsl_start.L = 1.0;
|
||||
hsl_end.L = 0.0;
|
||||
|
||||
for ( int i = 0; i < this.Width - 4; i++ ) // For each vertical line in the control:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Calculate Hue at this line (Saturation and Luminance are constant)
|
||||
hsl_end.H = hsl_start.H;
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, 1, this.Height - 4), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, 2, 1, this.Height - 4));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Luminance or Brightness value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Luminance()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL hsl_start = new AdobeColors.HSL();
|
||||
AdobeColors.HSL hsl_end = new AdobeColors.HSL();
|
||||
hsl_start.L = m_hsl.L;
|
||||
hsl_end.L = m_hsl.L;
|
||||
hsl_start.S = 1.0;
|
||||
hsl_end.S = 0.0;
|
||||
|
||||
for ( int i = 0; i < this.Width - 4; i++ ) // For each vertical line in the control:
|
||||
{
|
||||
hsl_start.H = (double)i/(this.Width - 4); // Calculate Hue at this line (Saturation and Luminance are constant)
|
||||
hsl_end.H = hsl_start.H;
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, 1, this.Height - 4), AdobeColors.HSL_to_RGB(hsl_start), AdobeColors.HSL_to_RGB(hsl_end), 90, false);
|
||||
g.FillRectangle(br,new Rectangle(i + 2, 2, 1, this.Height - 4));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Red value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Red()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
int red = m_rgb.R;;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
// Calculate Green at this line (Red and Blue are constant)
|
||||
int green = Round(255 - (255 * (double)i/(this.Height - 4)));
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), Color.FromArgb(red, green, 0), Color.FromArgb(red, green, 255), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Green value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Green()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
int green = m_rgb.G;;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
// Calculate Red at this line (Green and Blue are constant)
|
||||
int red = Round(255 - (255 * (double)i/(this.Height - 4)));
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), Color.FromArgb(red, green, 0), Color.FromArgb(red, green, 255), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the content of the control filling in all color values with the provided Blue value.
|
||||
/// </summary>
|
||||
private void Draw_Style_Blue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
int blue = m_rgb.B;;
|
||||
|
||||
for ( int i = 0; i < this.Height - 4; i++ ) // For each horizontal line in the control:
|
||||
{
|
||||
// Calculate Green at this line (Red and Blue are constant)
|
||||
int green = Round(255 - (255 * (double)i/(this.Height - 4)));
|
||||
|
||||
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(2,2, this.Width - 4, 1), Color.FromArgb(0, green, blue), Color.FromArgb(255, green, blue), 0, false);
|
||||
g.FillRectangle(br,new Rectangle(2,i + 2, this.Width - 4, 1));
|
||||
br.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calls all the functions neccessary to redraw the entire control.
|
||||
/// </summary>
|
||||
private void Redraw_Control()
|
||||
{
|
||||
DrawBorder();
|
||||
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
|
||||
DrawMarker(m_iMarker_X, m_iMarker_Y, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the marker position of the slider to match the controls color. Gives the option of redrawing the slider.
|
||||
/// </summary>
|
||||
/// <param name="Redraw">Set to true if you want the function to redraw the slider after determining the best position</param>
|
||||
private void Reset_Marker(bool Redraw)
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_iMarker_X = Round((this.Width - 4) * m_hsl.S);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - m_hsl.L));
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_iMarker_X = Round((this.Width - 4) * m_hsl.H);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - m_hsl.L));
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_iMarker_X = Round((this.Width - 4) * m_hsl.H);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - m_hsl.S));
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
m_iMarker_X = Round((this.Width - 4) * (double)m_rgb.B/255);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - (double)m_rgb.G/255));
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
m_iMarker_X = Round((this.Width - 4) * (double)m_rgb.B/255);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - (double)m_rgb.R/255));
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
m_iMarker_X = Round((this.Width - 4) * (double)m_rgb.R/255);
|
||||
m_iMarker_Y = Round((this.Height - 4) * (1.0 - (double)m_rgb.G/255));
|
||||
break;
|
||||
}
|
||||
|
||||
if ( Redraw )
|
||||
DrawMarker(m_iMarker_X, m_iMarker_Y, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the controls color (both HSL and RGB variables) based on the current marker position
|
||||
/// </summary>
|
||||
private void ResetHSLRGB()
|
||||
{
|
||||
int red, green, blue;
|
||||
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_hsl.S = (double)m_iMarker_X/(this.Width - 4);
|
||||
m_hsl.L = 1.0 - (double)m_iMarker_Y/(this.Height - 4);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_hsl.H = (double)m_iMarker_X/(this.Width - 4);
|
||||
m_hsl.L = 1.0 - (double)m_iMarker_Y/(this.Height - 4);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_hsl.H = (double)m_iMarker_X/(this.Width - 4);
|
||||
m_hsl.S = 1.0 - (double)m_iMarker_Y/(this.Height - 4);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
blue = Round(255 * (double)m_iMarker_X/(this.Width - 4));
|
||||
green = Round(255 * (1.0 - (double)m_iMarker_Y/(this.Height - 4)));
|
||||
m_rgb = Color.FromArgb(m_rgb.R, green, blue);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
blue = Round(255 * (double)m_iMarker_X/(this.Width - 4));
|
||||
red = Round(255 * (1.0 - (double)m_iMarker_Y/(this.Height - 4)));
|
||||
m_rgb = Color.FromArgb(red, m_rgb.G, blue);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
red = Round(255 * (double)m_iMarker_X/(this.Width - 4));
|
||||
green = Round(255 * (1.0 - (double)m_iMarker_Y/(this.Height - 4)));
|
||||
m_rgb = Color.FromArgb(red, green, m_rgb.B);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Kindof self explanitory, I really need to look up the .NET function that does this.
|
||||
/// </summary>
|
||||
/// <param name="val">double value to be rounded to an integer</param>
|
||||
/// <returns></returns>
|
||||
private int Round(double val)
|
||||
{
|
||||
int ret_val = (int)val;
|
||||
|
||||
int temp = (int)(val * 100);
|
||||
|
||||
if ( (temp % 100) >= 50 )
|
||||
ret_val += 1;
|
||||
|
||||
return ret_val;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the graphed color at the x,y position on the control
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private AdobeColors.HSL GetColor(int x, int y)
|
||||
{
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
_hsl.H = m_hsl.H;
|
||||
_hsl.S = (double)x/(this.Width - 4);
|
||||
_hsl.L = 1.0 - (double)y/(this.Height - 4);
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
_hsl.S = m_hsl.S;
|
||||
_hsl.H = (double)x/(this.Width - 4);
|
||||
_hsl.L = 1.0 - (double)y/(this.Height - 4);
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
_hsl.L = m_hsl.L;
|
||||
_hsl.H = (double)x/(this.Width - 4);
|
||||
_hsl.S = 1.0 - (double)y/(this.Height - 4);
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
_hsl = AdobeColors.RGB_to_HSL(Color.FromArgb(m_rgb.R, Round(255 * (1.0 - (double)y/(this.Height - 4))), Round(255 * (double)x/(this.Width - 4))));
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
_hsl = AdobeColors.RGB_to_HSL(Color.FromArgb(Round(255 * (1.0 - (double)y/(this.Height - 4))), m_rgb.G, Round(255 * (double)x/(this.Width - 4))));
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
_hsl = AdobeColors.RGB_to_HSL(Color.FromArgb(Round(255 * (double)x/(this.Width - 4)), Round(255 * (1.0 - (double)y/(this.Height - 4))), m_rgb.B));
|
||||
break;
|
||||
}
|
||||
|
||||
return _hsl;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,658 @@
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** Project: Joy-Con Color Picker *****/
|
||||
/***** Filename: ctrlVerticalColorSlider.cs *****/
|
||||
/***** Original Project: Adobe Color Picker Clone 1 *****/
|
||||
/***** Original Author: Danny Blanchard *****/
|
||||
/***** - scrabcakes@gmail.com *****/
|
||||
/***** Updates: *****/
|
||||
/***** 3/28/2005 - Initial Version : Danny Blanchard *****/
|
||||
/***** Feb 2018 - JoyCon Version : CTCaer *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
/******************************************************************/
|
||||
/***** *****/
|
||||
/***** This version is heavily optimised for use in *****/
|
||||
/***** CTCaer's Joy-Con Toolkit and other projects. *****/
|
||||
/***** *****/
|
||||
/******************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace jcColor {
|
||||
public delegate void EventHandler(object sender, EventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// A vertical slider control that shows a range for a color property (a.k.a. Hue, Saturation, Brightness,
|
||||
/// Red, Green, Blue) and sends an event when the slider is changed.
|
||||
/// </summary>
|
||||
public class ctrlVerticalColorSlider : System.Windows.Forms.UserControl
|
||||
{
|
||||
#region Class Variables
|
||||
|
||||
public enum eDrawStyle
|
||||
{
|
||||
Hue,
|
||||
Saturation,
|
||||
Brightness,
|
||||
Red,
|
||||
Green,
|
||||
Blue
|
||||
}
|
||||
|
||||
|
||||
// Slider properties
|
||||
private int m_iMarker_Start_Y = 0;
|
||||
private bool m_bDragging = false;
|
||||
|
||||
// These variables keep track of how to fill in the content inside the box;
|
||||
private eDrawStyle m_eDrawStyle = eDrawStyle.Hue;
|
||||
private AdobeColors.HSL m_hsl;
|
||||
private Color m_rgb;
|
||||
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors / Destructors
|
||||
|
||||
public ctrlVerticalColorSlider()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
// Initialize Colors
|
||||
m_hsl = new AdobeColors.HSL();
|
||||
m_hsl.H = 1.0;
|
||||
m_hsl.S = 1.0;
|
||||
m_hsl.L = 1.0;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
m_eDrawStyle = eDrawStyle.Hue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Component 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.SuspendLayout();
|
||||
//
|
||||
// ctrlVerticalColorSlider
|
||||
//
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
|
||||
this.ForeColor = System.Drawing.Color.DeepSkyBlue;
|
||||
this.Name = "ctrlVerticalColorSlider";
|
||||
this.Size = new System.Drawing.Size(40, 264);
|
||||
this.Load += new System.EventHandler(this.ctrl1DColorBar_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ctrl1DColorBar_Paint);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ctrl1DColorBar_MouseDown);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrl1DColorBar_MouseMove);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ctrl1DColorBar_MouseUp);
|
||||
this.Resize += new System.EventHandler(this.ctrl1DColorBar_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Control Events
|
||||
|
||||
private void ctrl1DColorBar_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
m_bDragging = true; // Begin dragging which notifies MouseMove function that it needs to update the marker
|
||||
|
||||
int y;
|
||||
y = e.Y;
|
||||
y -= 4; // Calculate slider position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 9 ) y = this.Height - 9;
|
||||
|
||||
if ( y == m_iMarker_Start_Y ) // If the slider hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawSlider(y, false); // Redraw the slider
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls slider(color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( !m_bDragging ) // Only respond when the mouse is dragging the marker.
|
||||
return;
|
||||
|
||||
int y;
|
||||
y = e.Y;
|
||||
y -= 4; // Calculate slider position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 9 ) y = this.Height - 9;
|
||||
|
||||
if ( y == m_iMarker_Start_Y ) // If the slider hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawSlider(y, false); // Redraw the slider
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls slider(color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if ( e.Button != MouseButtons.Left ) // Only respond to left mouse button events
|
||||
return;
|
||||
|
||||
m_bDragging = false;
|
||||
|
||||
int y;
|
||||
y = e.Y;
|
||||
y -= 4; // Calculate slider position
|
||||
if ( y < 0 ) y = 0;
|
||||
if ( y > this.Height - 9 ) y = this.Height - 9;
|
||||
|
||||
if ( y == m_iMarker_Start_Y ) // If the slider hasn't moved, no need to redraw it.
|
||||
return; // or send a scroll notification
|
||||
|
||||
DrawSlider(y, false); // Redraw the slider
|
||||
ResetHSLRGB(); // Reset the color
|
||||
|
||||
if ( Scroll != null ) // Notify anyone who cares that the controls slider(color) has changed
|
||||
Scroll(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
private void ctrl1DColorBar_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
Redraw_Control();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public new event EventHandler Scroll;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// The drawstyle of the contol (Hue, Saturation, Brightness, Red, Green or Blue)
|
||||
/// </summary>
|
||||
public eDrawStyle DrawStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_eDrawStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_eDrawStyle = value;
|
||||
|
||||
// Redraw the control based on the new eDrawStyle
|
||||
Reset_Slider(true);
|
||||
Redraw_Control();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The HSL color of the control, changing the HSL will automatically change the RGB color for the control.
|
||||
/// </summary>
|
||||
public AdobeColors.HSL HSL
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_hsl;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_hsl = value;
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Slider(true);
|
||||
DrawContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The RGB color of the control, changing the RGB will automatically change the HSL color for the control.
|
||||
/// </summary>
|
||||
public Color RGB
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rgb;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rgb = value;
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
|
||||
// Redraw the control based on the new color.
|
||||
Reset_Slider(true);
|
||||
DrawContent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Redraws the background over the slider area on both sides of the control
|
||||
/// </summary>
|
||||
private void ClearSlider()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
SolidBrush brush = new SolidBrush(Color.FromArgb(70,70,70));
|
||||
|
||||
g.FillRectangle(brush, 0, 0, 8, this.Height); // clear left hand slider
|
||||
g.FillRectangle(brush, this.Width - 8, 0, 8, this.Height); // clear right hand slider
|
||||
brush.Dispose();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the slider arrows on both sides of the control.
|
||||
/// </summary>
|
||||
/// <param name="position">position value of the slider, lowest being at the bottom. The range
|
||||
/// is between 0 and the controls height-9. The values will be adjusted if too large/small</param>
|
||||
/// <param name="Unconditional">If Unconditional is true, the slider is drawn, otherwise some logic
|
||||
/// is performed to determine is drawing is really neccessary.</param>
|
||||
private void DrawSlider(int position, bool Unconditional)
|
||||
{
|
||||
if ( position < 0 ) position = 0;
|
||||
if ( position > this.Height - 9 ) position = this.Height - 9;
|
||||
|
||||
if ( m_iMarker_Start_Y == position && !Unconditional ) // If the marker position hasn't changed
|
||||
return; // since the last time it was drawn and we don't HAVE to redraw
|
||||
// then exit procedure
|
||||
|
||||
m_iMarker_Start_Y = position; // Update the controls marker position
|
||||
|
||||
this.ClearSlider(); // Remove old slider
|
||||
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pencil = new Pen(Color.FromArgb(116,114,106)); // Same gray color Photoshop uses
|
||||
Brush brush = Brushes.White;
|
||||
|
||||
Point[] arrow = new Point[7]; // GGG
|
||||
arrow[0] = new Point(1,position); // G G
|
||||
arrow[1] = new Point(3,position); // G G
|
||||
arrow[2] = new Point(7,position + 4); // G G
|
||||
arrow[3] = new Point(3,position + 8); // G G
|
||||
arrow[4] = new Point(1,position + 8); // G G
|
||||
arrow[5] = new Point(0,position + 7); // G G
|
||||
arrow[6] = new Point(0,position + 1); // G G
|
||||
// GGG
|
||||
|
||||
g.FillPolygon(brush, arrow); // Fill left arrow with white
|
||||
g.DrawPolygon(pencil, arrow); // Draw left arrow border with gray
|
||||
|
||||
// GGG
|
||||
arrow[0] = new Point(this.Width - 2,position); // G G
|
||||
arrow[1] = new Point(this.Width - 4,position); // G G
|
||||
arrow[2] = new Point(this.Width - 8,position + 4); // G G
|
||||
arrow[3] = new Point(this.Width - 4,position + 8); // G G
|
||||
arrow[4] = new Point(this.Width - 2,position + 8); // G G
|
||||
arrow[5] = new Point(this.Width - 1,position + 7); // G G
|
||||
arrow[6] = new Point(this.Width - 1,position + 1); // G G
|
||||
// GGG
|
||||
|
||||
g.FillPolygon(brush, arrow); // Fill right arrow with white
|
||||
g.DrawPolygon(pencil, arrow); // Draw right arrow border with gray
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draws the border around the control, in this case the border around the content area between
|
||||
/// the slider arrows.
|
||||
/// </summary>
|
||||
private void DrawBorder()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
Pen pencil;
|
||||
|
||||
// To make the control look like Adobe Photoshop's the border around the control will be a gray line
|
||||
// on the top and left side, a white line on the bottom and right side, and a black rectangle (line)
|
||||
// inside the gray/white rectangle
|
||||
|
||||
pencil = new Pen(Color.FromArgb(100, 100, 100)); // The same gray color used by Photoshop
|
||||
g.DrawLine(pencil, this.Width - 10, 2, 9, 2); // Draw top line
|
||||
g.DrawLine(pencil, 9, 2, 9, this.Height - 4); // Draw left hand line
|
||||
|
||||
//pencil = new Pen(Color.FromArgb(120, 120, 120));
|
||||
g.DrawLine(pencil, this.Width - 9, 2, this.Width - 9,this.Height - 3); // Draw right hand line
|
||||
g.DrawLine(pencil, this.Width - 9,this.Height - 3, 9,this.Height - 3); // Draw bottome line
|
||||
|
||||
pencil = new Pen(Color.FromArgb(85, 85, 85));
|
||||
g.DrawRectangle(pencil, 10, 3, this.Width - 20, this.Height - 7); // Draw inner black rectangle
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the DrawStyle of the control and calls the appropriate
|
||||
/// drawing function for content
|
||||
/// </summary>
|
||||
private void DrawContent()
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Draw_Style_X - Content drawing functions
|
||||
|
||||
// The following functions do the real work of the control, drawing the primary content (the area between the slider)
|
||||
//
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Hue (from 0 to 360)
|
||||
/// </summary>
|
||||
private void Draw_Style_Hue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
_hsl.S = 1.0; // S and L will both be at 100% for this DrawStyle
|
||||
_hsl.L = 1.0;
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
_hsl.H = 1.0 - (double)i/(this.Height - 8); // H (hue) is based on the current vertical position
|
||||
Pen pen = new Pen(AdobeColors.HSL_to_RGB(_hsl)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Saturation (0 to 100%) for the given
|
||||
/// Hue and Luminance.
|
||||
/// </summary>
|
||||
private void Draw_Style_Saturation()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
_hsl.H = m_hsl.H; // Use the H and L values of the current color (m_hsl)
|
||||
_hsl.L = m_hsl.L;
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
_hsl.S = 1.0 - (double)i/(this.Height - 8); // S (Saturation) is based on the current vertical position
|
||||
Pen pen = new Pen(AdobeColors.HSL_to_RGB(_hsl)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Luminance (0 to 100%) for the given
|
||||
/// Hue and Saturation.
|
||||
/// </summary>
|
||||
private void Draw_Style_Luminance()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
AdobeColors.HSL _hsl = new AdobeColors.HSL();
|
||||
_hsl.H = m_hsl.H; // Use the H and S values of the current color (m_hsl)
|
||||
_hsl.S = m_hsl.S;
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
_hsl.L = 1.0 - (double)i/(this.Height - 8); // L (Luminance) is based on the current vertical position
|
||||
Pen pen = new Pen(AdobeColors.HSL_to_RGB(_hsl)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Red (0 to 255) for the given
|
||||
/// Green and Blue.
|
||||
/// </summary>
|
||||
private void Draw_Style_Red()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
int red = 255 - Round(255 * (double)i/(this.Height - 8)); // red is based on the current vertical position
|
||||
Pen pen = new Pen(Color.FromArgb(red, m_rgb.G, m_rgb.B)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Green (0 to 255) for the given
|
||||
/// Red and Blue.
|
||||
/// </summary>
|
||||
private void Draw_Style_Green()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
int green = 255 - Round(255 * (double)i/(this.Height - 8)); // green is based on the current vertical position
|
||||
Pen pen = new Pen(Color.FromArgb(m_rgb.R, green, m_rgb.B)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fills in the content of the control showing all values of Blue (0 to 255) for the given
|
||||
/// Red and Green.
|
||||
/// </summary>
|
||||
private void Draw_Style_Blue()
|
||||
{
|
||||
Graphics g = this.CreateGraphics();
|
||||
|
||||
for ( int i = 0; i < this.Height - 8; i++ ) // i represents the current line of pixels we want to draw horizontally
|
||||
{
|
||||
int blue = 255 - Round(255 * (double)i/(this.Height - 8)); // green is based on the current vertical position
|
||||
Pen pen = new Pen(Color.FromArgb(m_rgb.R, m_rgb.G, blue)); // Get the Color for this line
|
||||
|
||||
g.DrawLine(pen, 11, i + 4, this.Width - 11, i + 4); // Draw the line and loop back for next line
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Calls all the functions neccessary to redraw the entire control.
|
||||
/// </summary>
|
||||
private void Redraw_Control()
|
||||
{
|
||||
DrawSlider(m_iMarker_Start_Y, true);
|
||||
DrawBorder();
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
Draw_Style_Hue();
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
Draw_Style_Saturation();
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
Draw_Style_Luminance();
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
Draw_Style_Red();
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
Draw_Style_Green();
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
Draw_Style_Blue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the vertical position of the slider to match the controls color. Gives the option of redrawing the slider.
|
||||
/// </summary>
|
||||
/// <param name="Redraw">Set to true if you want the function to redraw the slider after determining the best position</param>
|
||||
private void Reset_Slider(bool Redraw)
|
||||
{
|
||||
// The position of the marker (slider) changes based on the current drawstyle:
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * m_hsl.H );
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * m_hsl.S );
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * m_hsl.L );
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * (double)m_rgb.R/255 );
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * (double)m_rgb.G/255 );
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
m_iMarker_Start_Y = (this.Height - 8) - Round( (this.Height - 8) * (double)m_rgb.B/255 );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( Redraw )
|
||||
DrawSlider(m_iMarker_Start_Y, true);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the controls color (both HSL and RGB variables) based on the current slider position
|
||||
/// </summary>
|
||||
private void ResetHSLRGB()
|
||||
{
|
||||
switch (m_eDrawStyle)
|
||||
{
|
||||
case eDrawStyle.Hue :
|
||||
m_hsl.H = 1.0 - (double)m_iMarker_Start_Y/(this.Height - 9);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Saturation :
|
||||
m_hsl.S = 1.0 - (double)m_iMarker_Start_Y/(this.Height - 9);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Brightness :
|
||||
m_hsl.L = 1.0 - (double)m_iMarker_Start_Y/(this.Height - 9);
|
||||
m_rgb = AdobeColors.HSL_to_RGB(m_hsl);
|
||||
break;
|
||||
case eDrawStyle.Red :
|
||||
m_rgb = Color.FromArgb(255 - Round( 255 * (double)m_iMarker_Start_Y/(this.Height - 9) ), m_rgb.G, m_rgb.B);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Green :
|
||||
m_rgb = Color.FromArgb(m_rgb.R, 255 - Round( 255 * (double)m_iMarker_Start_Y/(this.Height - 9) ), m_rgb.B);
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
case eDrawStyle.Blue :
|
||||
m_rgb = Color.FromArgb(m_rgb.R, m_rgb.G, 255 - Round( 255 * (double)m_iMarker_Start_Y/(this.Height - 9) ));
|
||||
m_hsl = AdobeColors.RGB_to_HSL(m_rgb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Kindof self explanitory, I really need to look up the .NET function that does this.
|
||||
/// </summary>
|
||||
/// <param name="val">double value to be rounded to an integer</param>
|
||||
/// <returns></returns>
|
||||
private int Round(double val)
|
||||
{
|
||||
int ret_val = (int)val;
|
||||
|
||||
int temp = (int)(val * 100);
|
||||
|
||||
if ( (temp % 100) >= 50 )
|
||||
ret_val += 1;
|
||||
|
||||
return ret_val;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,126 @@
|
||||
<?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>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 10</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>49</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>7.10.3077</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{22E08F67-4E40-4A92-876B-410FFD49B20E}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName />
|
||||
<AssemblyName>jcColor</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile />
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>jcColor</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject />
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>0.0</OldToolsVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>obj\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile />
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DocumentationFile />
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn />
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<Name>System.Windows.Forms</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.XML">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdobeColors.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ctrl2DColorBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ctrlVerticalColorSlider.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="EyedropColorPicker.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="frmJoyConColorPicker.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PresetNameDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PresetNameDialog.Designer.cs">
|
||||
<DependentUpon>PresetNameDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="RoundButton.cs" />
|
||||
<Compile Include="Util.cs" />
|
||||
<None Include="Resources\eyedropper.bmp" />
|
||||
<EmbeddedResource Include="ctrl2DColorBox.resx">
|
||||
<DependentUpon>ctrl2DColorBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ctrlVerticalColorSlider.resx">
|
||||
<DependentUpon>ctrlVerticalColorSlider.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="frmJoyConColorPicker.resx">
|
||||
<DependentUpon>frmJoyConColorPicker.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PresetNameDialog.resx">
|
||||
<DependentUpon>PresetNameDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.net4.7.1.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent />
|
||||
<PostBuildEvent />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+1226
-1209
File diff suppressed because it is too large.
Load diff
+6
-16
@@ -3,20 +3,10 @@
|
||||
#include "hidapi.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::ComponentModel;
|
||||
using namespace System::Collections;
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Data;
|
||||
using namespace System::Drawing;
|
||||
using namespace System::Resources;
|
||||
using namespace System::Xml;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::IO;
|
||||
using namespace System::Globalization;
|
||||
|
||||
template <typename T> T CLAMP(const T& value, const T& low, const T& high)
|
||||
{
|
||||
return value < low ? low : (value > high ? high : value);
|
||||
return value < low ? low : (value > high ? high : value);
|
||||
}
|
||||
|
||||
typedef uint8_t u8;
|
||||
@@ -53,9 +43,9 @@ int handler_close;
|
||||
int option_is_on;
|
||||
|
||||
namespace CppWinFormJoy {
|
||||
class images
|
||||
{
|
||||
//For annoying designer..
|
||||
//Todo.
|
||||
};
|
||||
class images
|
||||
{
|
||||
//For annoying designer..
|
||||
//Todo.
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
@@ -8,17 +8,17 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DF218734-A810-4FFF-8164-638680773512}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>jctool</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>jctool</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@@ -35,6 +35,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<EnableManagedIncrementalBuild>false</EnableManagedIncrementalBuild>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
@@ -59,8 +60,13 @@
|
||||
</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /Y "$(ProjectDir)Colors.config" "$(OutDir)Colors.config"</Command>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>$(ProjectDir)dpiawarev2.manifest.xml</AdditionalManifestFiles>
|
||||
<EnableDpiAwareness>false</EnableDpiAwareness>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -107,7 +113,11 @@
|
||||
<Image Include="pro2.ico" />
|
||||
<Image Include="pro_small.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="jc_colorpicker\jcColorDialog.vs2017.csproj">
|
||||
<Project>{22e08f67-4e40-4a92-876b-410ffd49b20e}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
File renamed without changes.
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<RetailColors>
|
||||
<RC key="retailpreset_01" rgb_color="828282" tooltip="Grey" />
|
||||
<RC key="retailpreset_02" rgb_color="0AB9E6" tooltip="Neon Blue" />
|
||||
<RC key="retailpreset_03" rgb_color="FF3C28" tooltip="Neon Red" />
|
||||
<RC key="retailpreset_04" rgb_color="E6FF00" tooltip="Neon Yellow" />
|
||||
<RC key="retailpreset_05" rgb_color="FF3278" tooltip="Neon Pink" />
|
||||
<RC key="retailpreset_06" rgb_color="1EDC00" tooltip="Neon Green" />
|
||||
<RC key="retailpreset_07" rgb_color="E10F00" tooltip="Red" />
|
||||
<RC key="retailpreset_08" rgb_color="323232" tooltip="Pro Black" />
|
||||
</RetailColors>
|
||||
<RetailColorsButtons>
|
||||
<RC key="retailpreset_09" rgb_color="0F0F0F" tooltip="Grey Buttons" />
|
||||
<RC key="retailpreset_10" rgb_color="001E1E" tooltip="Neon Blue Buttons" />
|
||||
<RC key="retailpreset_11" rgb_color="1E0A0A" tooltip="Neon Red Buttons" />
|
||||
<RC key="retailpreset_12" rgb_color="142800" tooltip="Neon Yellow Buttons" />
|
||||
<RC key="retailpreset_13" rgb_color="28001E" tooltip="Neon Pink Buttons" />
|
||||
<RC key="retailpreset_14" rgb_color="002800" tooltip="Neon Green Buttons" />
|
||||
<RC key="retailpreset_15" rgb_color="280A0A" tooltip="Red Buttons" />
|
||||
<RC key="retailpreset_16" rgb_color="FFFFFF" tooltip="Pro Black Buttons" />
|
||||
</RetailColorsButtons>
|
||||
</configuration>
|
||||
Reference in new issue
Block a user