* UIColorPicker: 增加手动输入ARGB值调色 #IBHL0H

This commit is contained in:
Sunny 2025-02-04 22:13:55 +08:00
parent c451a61a66
commit 8decdf00cf
2 changed files with 502 additions and 457 deletions

View File

@ -49,441 +49,457 @@ namespace Sunny.UI
private void InitializeComponent() private void InitializeComponent()
{ {
this.m_colorTable = new Sunny.UI.UIColorTable(); m_colorTable = new UIColorTable();
this.m_colorSample = new Sunny.UI.LabelRotate(); m_colorSample = new LabelRotate();
this.edtA = new Sunny.UI.UITextBox(); edtA = new UITextBox();
this.edtR = new Sunny.UI.UITextBox(); edtR = new UITextBox();
this.edtG = new Sunny.UI.UITextBox(); edtG = new UITextBox();
this.edtB = new Sunny.UI.UITextBox(); edtB = new UITextBox();
this.lblA = new Sunny.UI.UILabel(); lblA = new UILabel();
this.lblR = new Sunny.UI.UILabel(); lblR = new UILabel();
this.lblG = new Sunny.UI.UILabel(); lblG = new UILabel();
this.lblB = new Sunny.UI.UILabel(); lblB = new UILabel();
this.m_colorWheel = new Sunny.UI.UIColorWheel(); m_colorWheel = new UIColorWheel();
this.m_colorBar = new Sunny.UI.HSLColorSlider(); m_colorBar = new HSLColorSlider();
this.m_opacitySlider = new Sunny.UI.ColorSlider(); m_opacitySlider = new ColorSlider();
this.btnOK = new Sunny.UI.UISymbolButton(); btnOK = new UISymbolButton();
this.btnCancel = new Sunny.UI.UISymbolButton(); btnCancel = new UISymbolButton();
this.SuspendLayout(); SuspendLayout();
// //
// m_colorTable // m_colorTable
// //
this.m_colorTable.BackColor = System.Drawing.Color.Transparent; m_colorTable.BackColor = Color.Transparent;
this.m_colorTable.Colors = new System.Drawing.Color[] { m_colorTable.Colors = new Color[]
System.Drawing.Color.Black, {
System.Drawing.Color.DarkGreen, Color.Black,
System.Drawing.Color.DarkSlateGray, Color.DarkGreen,
System.Drawing.Color.Purple, Color.DarkSlateGray,
System.Drawing.Color.Maroon, Color.Purple,
System.Drawing.Color.Teal, Color.Maroon,
System.Drawing.Color.Green, Color.Teal,
System.Drawing.Color.Olive, Color.Green,
System.Drawing.Color.Navy, Color.Olive,
System.Drawing.Color.Indigo, Color.Navy,
System.Drawing.Color.MidnightBlue, Color.Indigo,
System.Drawing.Color.DarkRed, Color.MidnightBlue,
System.Drawing.Color.DarkMagenta, Color.DarkRed,
System.Drawing.Color.DarkBlue, Color.DarkMagenta,
System.Drawing.Color.DarkCyan, Color.DarkBlue,
System.Drawing.Color.DarkOliveGreen, Color.DarkCyan,
System.Drawing.Color.SaddleBrown, Color.DarkOliveGreen,
System.Drawing.Color.ForestGreen, Color.SaddleBrown,
System.Drawing.Color.OliveDrab, Color.ForestGreen,
System.Drawing.Color.SeaGreen, Color.OliveDrab,
System.Drawing.Color.DarkGoldenrod, Color.SeaGreen,
System.Drawing.Color.DarkSlateBlue, Color.DarkGoldenrod,
System.Drawing.Color.MediumBlue, Color.DarkSlateBlue,
System.Drawing.Color.Sienna, Color.MediumBlue,
System.Drawing.Color.Brown, Color.Sienna,
System.Drawing.Color.DarkTurquoise, Color.Brown,
System.Drawing.Color.DimGray, Color.DarkTurquoise,
System.Drawing.Color.LightSeaGreen, Color.DimGray,
System.Drawing.Color.DarkViolet, Color.LightSeaGreen,
System.Drawing.Color.Firebrick, Color.DarkViolet,
System.Drawing.Color.MediumVioletRed, Color.Firebrick,
System.Drawing.Color.MediumSeaGreen, Color.MediumVioletRed,
System.Drawing.Color.Crimson, Color.MediumSeaGreen,
System.Drawing.Color.Chocolate, Color.Crimson,
System.Drawing.Color.MediumSpringGreen, Color.Chocolate,
System.Drawing.Color.Goldenrod, Color.MediumSpringGreen,
System.Drawing.Color.SteelBlue, Color.Goldenrod,
System.Drawing.Color.LawnGreen, Color.SteelBlue,
System.Drawing.Color.DarkOrchid, Color.LawnGreen,
System.Drawing.Color.Orange, Color.DarkOrchid,
System.Drawing.Color.LimeGreen, Color.Orange,
System.Drawing.Color.Yellow, Color.LimeGreen,
System.Drawing.Color.Gold, Color.Yellow,
System.Drawing.Color.Red, Color.Gold,
System.Drawing.Color.Magenta, Color.Red,
System.Drawing.Color.Lime, Color.Magenta,
System.Drawing.Color.SpringGreen, Color.Lime,
System.Drawing.Color.YellowGreen, Color.SpringGreen,
System.Drawing.Color.Chartreuse, Color.YellowGreen,
System.Drawing.Color.DeepSkyBlue, Color.Chartreuse,
System.Drawing.Color.Aqua, Color.DeepSkyBlue,
System.Drawing.Color.OrangeRed, Color.Aqua,
System.Drawing.Color.Blue, Color.OrangeRed,
System.Drawing.Color.DarkOrange, Color.Blue,
System.Drawing.Color.CadetBlue, Color.DarkOrange,
System.Drawing.Color.Cyan, Color.CadetBlue,
System.Drawing.Color.Fuchsia, Color.Cyan,
System.Drawing.Color.Gray, Color.Fuchsia,
System.Drawing.Color.SlateGray, Color.Gray,
System.Drawing.Color.Peru, Color.SlateGray,
System.Drawing.Color.BlueViolet, Color.Peru,
System.Drawing.Color.LightSlateGray, Color.BlueViolet,
System.Drawing.Color.DeepPink, Color.LightSlateGray,
System.Drawing.Color.MediumTurquoise, Color.DeepPink,
System.Drawing.Color.DodgerBlue, Color.MediumTurquoise,
System.Drawing.Color.Turquoise, Color.DodgerBlue,
System.Drawing.Color.RoyalBlue, Color.Turquoise,
System.Drawing.Color.SlateBlue, Color.RoyalBlue,
System.Drawing.Color.MediumOrchid, Color.SlateBlue,
System.Drawing.Color.DarkKhaki, Color.MediumOrchid,
System.Drawing.Color.IndianRed, Color.DarkKhaki,
System.Drawing.Color.GreenYellow, Color.IndianRed,
System.Drawing.Color.MediumAquamarine, Color.GreenYellow,
System.Drawing.Color.Tomato, Color.MediumAquamarine,
System.Drawing.Color.DarkSeaGreen, Color.Tomato,
System.Drawing.Color.Orchid, Color.DarkSeaGreen,
System.Drawing.Color.RosyBrown, Color.Orchid,
System.Drawing.Color.PaleVioletRed, Color.RosyBrown,
System.Drawing.Color.MediumPurple, Color.PaleVioletRed,
System.Drawing.Color.Coral, Color.MediumPurple,
System.Drawing.Color.CornflowerBlue, Color.Coral,
System.Drawing.Color.DarkGray, Color.CornflowerBlue,
System.Drawing.Color.SandyBrown, Color.DarkGray,
System.Drawing.Color.MediumSlateBlue, Color.SandyBrown,
System.Drawing.Color.Tan, Color.MediumSlateBlue,
System.Drawing.Color.DarkSalmon, Color.Tan,
System.Drawing.Color.BurlyWood, Color.DarkSalmon,
System.Drawing.Color.HotPink, Color.BurlyWood,
System.Drawing.Color.Salmon, Color.HotPink,
System.Drawing.Color.Violet, Color.Salmon,
System.Drawing.Color.LightCoral, Color.Violet,
System.Drawing.Color.SkyBlue, Color.LightCoral,
System.Drawing.Color.LightSalmon, Color.SkyBlue,
System.Drawing.Color.Khaki, Color.LightSalmon,
System.Drawing.Color.Plum, Color.Khaki,
System.Drawing.Color.LightGreen, Color.Plum,
System.Drawing.Color.Aquamarine, Color.LightGreen,
System.Drawing.Color.Silver, Color.Aquamarine,
System.Drawing.Color.LightSkyBlue, Color.Silver,
System.Drawing.Color.LightSteelBlue, Color.LightSkyBlue,
System.Drawing.Color.LightBlue, Color.LightSteelBlue,
System.Drawing.Color.PaleGreen, Color.LightBlue,
System.Drawing.Color.PowderBlue, Color.PaleGreen,
System.Drawing.Color.Thistle, Color.PowderBlue,
System.Drawing.Color.PaleGoldenrod, Color.Thistle,
System.Drawing.Color.PaleTurquoise, Color.PaleGoldenrod,
System.Drawing.Color.LightGray, Color.PaleTurquoise,
System.Drawing.Color.Wheat, Color.LightGray,
System.Drawing.Color.NavajoWhite, Color.Wheat,
System.Drawing.Color.Moccasin, Color.NavajoWhite,
System.Drawing.Color.LightPink, Color.Moccasin,
System.Drawing.Color.PeachPuff, Color.LightPink,
System.Drawing.Color.Gainsboro, Color.PeachPuff,
System.Drawing.Color.Pink, Color.Gainsboro,
System.Drawing.Color.Bisque, Color.Pink,
System.Drawing.Color.LightGoldenrodYellow, Color.Bisque,
System.Drawing.Color.LemonChiffon, Color.LightGoldenrodYellow,
System.Drawing.Color.BlanchedAlmond, Color.LemonChiffon,
System.Drawing.Color.Beige, Color.BlanchedAlmond,
System.Drawing.Color.AntiqueWhite, Color.Beige,
System.Drawing.Color.PapayaWhip, Color.AntiqueWhite,
System.Drawing.Color.Cornsilk, Color.PapayaWhip,
System.Drawing.Color.LightYellow, Color.Cornsilk,
System.Drawing.Color.LightCyan, Color.LightYellow,
System.Drawing.Color.Lavender, Color.LightCyan,
System.Drawing.Color.Linen, Color.Lavender,
System.Drawing.Color.MistyRose, Color.Linen,
System.Drawing.Color.OldLace, Color.MistyRose,
System.Drawing.Color.WhiteSmoke, Color.OldLace,
System.Drawing.Color.SeaShell, Color.WhiteSmoke,
System.Drawing.Color.Azure, Color.SeaShell,
System.Drawing.Color.Honeydew, Color.Azure,
System.Drawing.Color.Ivory, Color.Honeydew,
System.Drawing.Color.LavenderBlush, Color.Ivory,
System.Drawing.Color.FloralWhite, Color.LavenderBlush,
System.Drawing.Color.AliceBlue, Color.FloralWhite,
System.Drawing.Color.MintCream, Color.AliceBlue,
System.Drawing.Color.GhostWhite, Color.MintCream,
System.Drawing.Color.Snow, Color.GhostWhite,
System.Drawing.Color.White}; Color.Snow,
this.m_colorTable.Cols = 16; Color.White
this.m_colorTable.FieldSize = new System.Drawing.Size(12, 12); };
this.m_colorTable.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); m_colorTable.Cols = 16;
this.m_colorTable.Location = new System.Drawing.Point(10, 8); m_colorTable.FieldSize = new Size(12, 12);
this.m_colorTable.Name = "m_colorTable"; m_colorTable.FrameColor = Color.FromArgb(80, 160, 255);
this.m_colorTable.Padding = new System.Windows.Forms.Padding(8); m_colorTable.Location = new Point(10, 8);
this.m_colorTable.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter; m_colorTable.Name = "m_colorTable";
this.m_colorTable.SelectedItem = System.Drawing.Color.Black; m_colorTable.Padding = new System.Windows.Forms.Padding(8);
this.m_colorTable.Size = new System.Drawing.Size(253, 148); m_colorTable.RotatePointAlignment = ContentAlignment.MiddleCenter;
this.m_colorTable.Style = Sunny.UI.UIStyle.Custom; m_colorTable.SelectedItem = Color.Black;
this.m_colorTable.StyleCustomMode = false; m_colorTable.Size = new Size(253, 148);
this.m_colorTable.TabIndex = 0; m_colorTable.Style = UIStyle.Custom;
this.m_colorTable.TagString = null; m_colorTable.TabIndex = 0;
this.m_colorTable.Text = "colorTable1"; m_colorTable.Text = "colorTable1";
this.m_colorTable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; m_colorTable.TextAlign = ContentAlignment.MiddleLeft;
this.m_colorTable.TextAngle = 0F; m_colorTable.TextAngle = 0F;
this.m_colorTable.SelectedIndexChanged += new System.EventHandler(this.m_colorTable_SelectedIndexChanged); m_colorTable.SelectedIndexChanged += m_colorTable_SelectedIndexChanged;
// //
// m_colorSample // m_colorSample
// //
this.m_colorSample.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); m_colorSample.FrameColor = Color.FromArgb(80, 160, 255);
this.m_colorSample.Location = new System.Drawing.Point(10, 163); m_colorSample.Location = new Point(10, 163);
this.m_colorSample.Name = "m_colorSample"; m_colorSample.Name = "m_colorSample";
this.m_colorSample.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter; m_colorSample.RotatePointAlignment = ContentAlignment.MiddleCenter;
this.m_colorSample.Size = new System.Drawing.Size(253, 26); m_colorSample.Size = new Size(253, 26);
this.m_colorSample.Style = Sunny.UI.UIStyle.Custom; m_colorSample.Style = UIStyle.Custom;
this.m_colorSample.StyleCustomMode = false; m_colorSample.TabIndex = 1;
this.m_colorSample.TabIndex = 1; m_colorSample.TabStop = false;
this.m_colorSample.TabStop = false; m_colorSample.TextAlign = ContentAlignment.MiddleLeft;
this.m_colorSample.TagString = null; m_colorSample.TextAngle = 0F;
this.m_colorSample.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; m_colorSample.Paint += m_colorSample_Paint;
this.m_colorSample.TextAngle = 0F;
this.m_colorSample.Paint += new System.Windows.Forms.PaintEventHandler(this.m_colorSample_Paint);
// //
// edtA // edtA
// //
this.edtA.Cursor = System.Windows.Forms.Cursors.IBeam; edtA.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtA.FillColor = System.Drawing.Color.White; edtA.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.edtA.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); edtA.Location = new Point(29, 197);
this.edtA.Location = new System.Drawing.Point(29, 197); edtA.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtA.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); edtA.Maximum = 255D;
this.edtA.Maximum = 255D; edtA.Minimum = 0D;
this.edtA.Minimum = 0D; edtA.MinimumSize = new Size(1, 16);
this.edtA.Name = "edtA"; edtA.Name = "edtA";
this.edtA.Padding = new System.Windows.Forms.Padding(5); edtA.Padding = new System.Windows.Forms.Padding(5);
this.edtA.Size = new System.Drawing.Size(41, 26); edtA.ShowText = false;
this.edtA.Style = Sunny.UI.UIStyle.Custom; edtA.Size = new Size(41, 26);
this.edtA.TabIndex = 2; edtA.Style = UIStyle.Custom;
this.edtA.Text = "0"; edtA.TabIndex = 2;
this.edtA.Type = Sunny.UI.UITextBox.UIEditType.Integer; edtA.Text = "0";
edtA.TextAlignment = ContentAlignment.MiddleLeft;
edtA.Type = UITextBox.UIEditType.Integer;
edtA.Watermark = "";
edtA.LostFocus += edtA_TextChanged;
// //
// edtR // edtR
// //
this.edtR.Cursor = System.Windows.Forms.Cursors.IBeam; edtR.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtR.FillColor = System.Drawing.Color.White; edtR.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.edtR.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); edtR.Location = new Point(93, 197);
this.edtR.Location = new System.Drawing.Point(93, 197); edtR.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtR.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); edtR.Maximum = 255D;
this.edtR.Maximum = 255D; edtR.Minimum = 0D;
this.edtR.Minimum = 0D; edtR.MinimumSize = new Size(1, 16);
this.edtR.Name = "edtR"; edtR.Name = "edtR";
this.edtR.Padding = new System.Windows.Forms.Padding(5); edtR.Padding = new System.Windows.Forms.Padding(5);
this.edtR.Size = new System.Drawing.Size(41, 26); edtR.ShowText = false;
this.edtR.Style = Sunny.UI.UIStyle.Custom; edtR.Size = new Size(41, 26);
this.edtR.TabIndex = 3; edtR.Style = UIStyle.Custom;
this.edtR.Text = "0"; edtR.TabIndex = 3;
this.edtR.Type = Sunny.UI.UITextBox.UIEditType.Integer; edtR.Text = "0";
edtR.TextAlignment = ContentAlignment.MiddleLeft;
edtR.Type = UITextBox.UIEditType.Integer;
edtR.Watermark = "";
edtR.LostFocus += edtR_TextChanged;
// //
// edtG // edtG
// //
this.edtG.Cursor = System.Windows.Forms.Cursors.IBeam; edtG.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtG.FillColor = System.Drawing.Color.White; edtG.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.edtG.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); edtG.Location = new Point(158, 197);
this.edtG.Location = new System.Drawing.Point(158, 197); edtG.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtG.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); edtG.Maximum = 255D;
this.edtG.Maximum = 255D; edtG.Minimum = 0D;
this.edtG.Minimum = 0D; edtG.MinimumSize = new Size(1, 16);
this.edtG.Name = "edtG"; edtG.Name = "edtG";
this.edtG.Padding = new System.Windows.Forms.Padding(5); edtG.Padding = new System.Windows.Forms.Padding(5);
this.edtG.Size = new System.Drawing.Size(41, 26); edtG.ShowText = false;
this.edtG.Style = Sunny.UI.UIStyle.Custom; edtG.Size = new Size(41, 26);
this.edtG.TabIndex = 4; edtG.Style = UIStyle.Custom;
this.edtG.Text = "0"; edtG.TabIndex = 4;
this.edtG.Type = Sunny.UI.UITextBox.UIEditType.Integer; edtG.Text = "0";
edtG.TextAlignment = ContentAlignment.MiddleLeft;
edtG.Type = UITextBox.UIEditType.Integer;
edtG.Watermark = "";
edtG.LostFocus += edtG_TextChanged;
// //
// edtB // edtB
// //
this.edtB.Cursor = System.Windows.Forms.Cursors.IBeam; edtB.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtB.FillColor = System.Drawing.Color.White; edtB.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.edtB.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); edtB.Location = new Point(222, 197);
this.edtB.Location = new System.Drawing.Point(222, 197); edtB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); edtB.Maximum = 255D;
this.edtB.Maximum = 255D; edtB.Minimum = 0D;
this.edtB.Minimum = 0D; edtB.MinimumSize = new Size(1, 16);
this.edtB.Name = "edtB"; edtB.Name = "edtB";
this.edtB.Padding = new System.Windows.Forms.Padding(5); edtB.Padding = new System.Windows.Forms.Padding(5);
this.edtB.Size = new System.Drawing.Size(41, 26); edtB.ShowText = false;
this.edtB.Style = Sunny.UI.UIStyle.Custom; edtB.Size = new Size(41, 26);
this.edtB.TabIndex = 5; edtB.Style = UIStyle.Custom;
this.edtB.Text = "0"; edtB.TabIndex = 5;
this.edtB.Type = Sunny.UI.UITextBox.UIEditType.Integer; edtB.Text = "0";
edtB.TextAlignment = ContentAlignment.MiddleLeft;
edtB.Type = UITextBox.UIEditType.Integer;
edtB.Watermark = "";
edtB.LostFocus += edtB_TextChanged;
// //
// lblA // lblA
// //
this.lblA.AutoSize = true; lblA.AutoSize = true;
this.lblA.BackColor = System.Drawing.Color.Transparent; lblA.BackColor = Color.Transparent;
this.lblA.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); lblA.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.lblA.Location = new System.Drawing.Point(9, 200); lblA.ForeColor = Color.FromArgb(48, 48, 48);
this.lblA.Name = "lblA"; lblA.Location = new Point(9, 200);
this.lblA.Size = new System.Drawing.Size(19, 20); lblA.Name = "lblA";
this.lblA.Style = Sunny.UI.UIStyle.Custom; lblA.Size = new Size(14, 14);
this.lblA.TabIndex = 6; lblA.Style = UIStyle.Custom;
this.lblA.Text = "A"; lblA.TabIndex = 6;
this.lblA.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lblA.Text = "A";
lblA.TextAlign = ContentAlignment.MiddleLeft;
// //
// lblR // lblR
// //
this.lblR.AutoSize = true; lblR.AutoSize = true;
this.lblR.BackColor = System.Drawing.Color.Transparent; lblR.BackColor = Color.Transparent;
this.lblR.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); lblR.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.lblR.Location = new System.Drawing.Point(74, 200); lblR.ForeColor = Color.FromArgb(48, 48, 48);
this.lblR.Name = "lblR"; lblR.Location = new Point(74, 200);
this.lblR.Size = new System.Drawing.Size(18, 20); lblR.Name = "lblR";
this.lblR.Style = Sunny.UI.UIStyle.Custom; lblR.Size = new Size(14, 14);
this.lblR.TabIndex = 7; lblR.Style = UIStyle.Custom;
this.lblR.Text = "R"; lblR.TabIndex = 7;
this.lblR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lblR.Text = "R";
lblR.TextAlign = ContentAlignment.MiddleLeft;
// //
// lblG // lblG
// //
this.lblG.AutoSize = true; lblG.AutoSize = true;
this.lblG.BackColor = System.Drawing.Color.Transparent; lblG.BackColor = Color.Transparent;
this.lblG.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); lblG.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.lblG.Location = new System.Drawing.Point(138, 200); lblG.ForeColor = Color.FromArgb(48, 48, 48);
this.lblG.Name = "lblG"; lblG.Location = new Point(138, 200);
this.lblG.Size = new System.Drawing.Size(19, 20); lblG.Name = "lblG";
this.lblG.Style = Sunny.UI.UIStyle.Custom; lblG.Size = new Size(14, 14);
this.lblG.TabIndex = 8; lblG.Style = UIStyle.Custom;
this.lblG.Text = "G"; lblG.TabIndex = 8;
this.lblG.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lblG.Text = "G";
lblG.TextAlign = ContentAlignment.MiddleLeft;
// //
// lblB // lblB
// //
this.lblB.AutoSize = true; lblB.AutoSize = true;
this.lblB.BackColor = System.Drawing.Color.Transparent; lblB.BackColor = Color.Transparent;
this.lblB.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); lblB.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.lblB.Location = new System.Drawing.Point(203, 200); lblB.ForeColor = Color.FromArgb(48, 48, 48);
this.lblB.Name = "lblB"; lblB.Location = new Point(203, 200);
this.lblB.Size = new System.Drawing.Size(18, 20); lblB.Name = "lblB";
this.lblB.Style = Sunny.UI.UIStyle.Custom; lblB.Size = new Size(14, 14);
this.lblB.TabIndex = 9; lblB.Style = UIStyle.Custom;
this.lblB.Text = "B"; lblB.TabIndex = 9;
this.lblB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; lblB.Text = "B";
lblB.TextAlign = ContentAlignment.MiddleLeft;
// //
// m_colorWheel // m_colorWheel
// //
this.m_colorWheel.BackColor = System.Drawing.Color.Transparent; m_colorWheel.BackColor = Color.Transparent;
this.m_colorWheel.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); m_colorWheel.FrameColor = Color.FromArgb(80, 160, 255);
this.m_colorWheel.Location = new System.Drawing.Point(269, 8); m_colorWheel.Location = new Point(269, 8);
this.m_colorWheel.Name = "m_colorWheel"; m_colorWheel.Name = "m_colorWheel";
this.m_colorWheel.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(235)))), ((int)(((byte)(205))))); m_colorWheel.SelectedColor = Color.FromArgb(254, 235, 205);
this.m_colorWheel.Size = new System.Drawing.Size(148, 148); m_colorWheel.Size = new Size(148, 148);
this.m_colorWheel.Style = Sunny.UI.UIStyle.Custom; m_colorWheel.Style = UIStyle.Custom;
this.m_colorWheel.StyleCustomMode = false; m_colorWheel.TabIndex = 10;
this.m_colorWheel.TabIndex = 10; m_colorWheel.Text = "colorWheel1";
this.m_colorWheel.TagString = null; m_colorWheel.SelectedColorChanged += m_colorWheel_SelectedColorChanged;
this.m_colorWheel.Text = "colorWheel1";
this.m_colorWheel.SelectedColorChanged += new System.EventHandler(this.m_colorWheel_SelectedColorChanged);
// //
// m_colorBar // m_colorBar
// //
this.m_colorBar.BackColor = System.Drawing.Color.Transparent; m_colorBar.BackColor = Color.Transparent;
this.m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10); m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10);
this.m_colorBar.Color1 = System.Drawing.Color.Black; m_colorBar.Color1 = Color.Black;
this.m_colorBar.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(127)))), ((int)(((byte)(127))))); m_colorBar.Color2 = Color.FromArgb(127, 127, 127);
this.m_colorBar.Color3 = System.Drawing.Color.White; m_colorBar.Color3 = Color.White;
this.m_colorBar.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); m_colorBar.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
this.m_colorBar.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); m_colorBar.FrameColor = Color.FromArgb(80, 160, 255);
this.m_colorBar.Location = new System.Drawing.Point(422, 8); m_colorBar.Location = new Point(422, 8);
this.m_colorBar.Name = "m_colorBar"; m_colorBar.Name = "m_colorBar";
this.m_colorBar.NumberOfColors = Sunny.UI.ColorSlider.eNumberOfColors.Use3Colors; m_colorBar.NumberOfColors = ColorSlider.eNumberOfColors.Use3Colors;
this.m_colorBar.Orientation = System.Windows.Forms.Orientation.Vertical; m_colorBar.Orientation = System.Windows.Forms.Orientation.Vertical;
this.m_colorBar.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); m_colorBar.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.m_colorBar.Percent = 0F; m_colorBar.Percent = 0F;
this.m_colorBar.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleRight; m_colorBar.RotatePointAlignment = ContentAlignment.MiddleRight;
this.m_colorBar.Size = new System.Drawing.Size(45, 148); m_colorBar.Size = new Size(45, 148);
this.m_colorBar.Style = Sunny.UI.UIStyle.Custom; m_colorBar.Style = UIStyle.Custom;
this.m_colorBar.StyleCustomMode = false; m_colorBar.TabIndex = 11;
this.m_colorBar.TabIndex = 11; m_colorBar.Text = "Lightness";
this.m_colorBar.TagString = null; m_colorBar.TextAlign = ContentAlignment.BottomCenter;
this.m_colorBar.Text = "Lightness"; m_colorBar.TextAngle = 270F;
this.m_colorBar.TextAlign = System.Drawing.ContentAlignment.BottomCenter; m_colorBar.ValueOrientation = ColorSlider.eValueOrientation.MaxToMin;
this.m_colorBar.TextAngle = 270F; m_colorBar.SelectedValueChanged += m_colorBar_SelectedValueChanged;
this.m_colorBar.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MaxToMin;
this.m_colorBar.SelectedValueChanged += new System.EventHandler(this.m_colorBar_SelectedValueChanged);
// //
// m_opacitySlider // m_opacitySlider
// //
this.m_opacitySlider.BackColor = System.Drawing.Color.Transparent; m_opacitySlider.BackColor = Color.Transparent;
this.m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25); m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25);
this.m_opacitySlider.Color1 = System.Drawing.Color.White; m_opacitySlider.Color1 = Color.White;
this.m_opacitySlider.Color2 = System.Drawing.Color.Black; m_opacitySlider.Color2 = Color.Black;
this.m_opacitySlider.Color3 = System.Drawing.Color.Black; m_opacitySlider.Color3 = Color.Black;
this.m_opacitySlider.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); m_opacitySlider.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 0);
this.m_opacitySlider.ForeColor = System.Drawing.Color.Black; m_opacitySlider.ForeColor = Color.Black;
this.m_opacitySlider.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); m_opacitySlider.FrameColor = Color.FromArgb(80, 160, 255);
this.m_opacitySlider.Location = new System.Drawing.Point(269, 163); m_opacitySlider.Location = new Point(269, 163);
this.m_opacitySlider.Name = "m_opacitySlider"; m_opacitySlider.Name = "m_opacitySlider";
this.m_opacitySlider.NumberOfColors = Sunny.UI.ColorSlider.eNumberOfColors.Use2Colors; m_opacitySlider.NumberOfColors = ColorSlider.eNumberOfColors.Use2Colors;
this.m_opacitySlider.Orientation = System.Windows.Forms.Orientation.Horizontal; m_opacitySlider.Orientation = System.Windows.Forms.Orientation.Horizontal;
this.m_opacitySlider.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); m_opacitySlider.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.m_opacitySlider.Percent = 1F; m_opacitySlider.Percent = 1F;
this.m_opacitySlider.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter; m_opacitySlider.RotatePointAlignment = ContentAlignment.MiddleCenter;
this.m_opacitySlider.Size = new System.Drawing.Size(198, 26); m_opacitySlider.Size = new Size(198, 26);
this.m_opacitySlider.Style = Sunny.UI.UIStyle.Custom; m_opacitySlider.Style = UIStyle.Custom;
this.m_opacitySlider.StyleCustomMode = false; m_opacitySlider.TabIndex = 1;
this.m_opacitySlider.TabIndex = 1; m_opacitySlider.Text = "Opacity";
this.m_opacitySlider.TagString = null; m_opacitySlider.TextAlign = ContentAlignment.MiddleLeft;
this.m_opacitySlider.Text = "Opacity"; m_opacitySlider.TextAngle = 0F;
this.m_opacitySlider.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; m_opacitySlider.ValueOrientation = ColorSlider.eValueOrientation.MinToMax;
this.m_opacitySlider.TextAngle = 0F; m_opacitySlider.SelectedValueChanged += m_opacitySlider_SelectedValueChanged;
this.m_opacitySlider.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MinToMax;
this.m_opacitySlider.SelectedValueChanged += new System.EventHandler(this.m_opacitySlider_SelectedValueChanged);
// //
// btnOK // btnOK
// //
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand; btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Font = new System.Drawing.Font("宋体", 12F); btnOK.Font = new Font("宋体", 12F);
this.btnOK.Location = new System.Drawing.Point(269, 197); btnOK.Location = new Point(269, 197);
this.btnOK.Name = "btnOK"; btnOK.MinimumSize = new Size(1, 1);
this.btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(95, 26); btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnOK.Style = Sunny.UI.UIStyle.Custom; btnOK.Size = new Size(95, 26);
this.btnOK.TabIndex = 12; btnOK.Style = UIStyle.Custom;
this.btnOK.Text = "确定"; btnOK.TabIndex = 12;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click); btnOK.Text = "确定";
btnOK.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnOK.Click += btnOK_Click;
// //
// btnCancel // btnCancel
// //
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Font = new System.Drawing.Font("宋体", 12F); btnCancel.Font = new Font("宋体", 12F);
this.btnCancel.Location = new System.Drawing.Point(372, 197); btnCancel.Location = new Point(372, 197);
this.btnCancel.Name = "btnCancel"; btnCancel.MinimumSize = new Size(1, 1);
this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(95, 26); btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnCancel.Style = Sunny.UI.UIStyle.Custom; btnCancel.Size = new Size(95, 26);
this.btnCancel.Symbol = 61453; btnCancel.Style = UIStyle.Custom;
this.btnCancel.TabIndex = 13; btnCancel.Symbol = 61453;
this.btnCancel.Text = "取消"; btnCancel.TabIndex = 13;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); btnCancel.Text = "取消";
btnCancel.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnCancel.Click += btnCancel_Click;
// //
// UIColorItem // UIColorItem
// //
this.Controls.Add(this.btnCancel); Controls.Add(btnCancel);
this.Controls.Add(this.btnOK); Controls.Add(btnOK);
this.Controls.Add(this.m_opacitySlider); Controls.Add(m_opacitySlider);
this.Controls.Add(this.m_colorBar); Controls.Add(m_colorBar);
this.Controls.Add(this.m_colorWheel); Controls.Add(m_colorWheel);
this.Controls.Add(this.lblB); Controls.Add(lblB);
this.Controls.Add(this.lblG); Controls.Add(lblG);
this.Controls.Add(this.lblR); Controls.Add(lblR);
this.Controls.Add(this.lblA); Controls.Add(lblA);
this.Controls.Add(this.edtB); Controls.Add(edtB);
this.Controls.Add(this.edtG); Controls.Add(edtG);
this.Controls.Add(this.edtR); Controls.Add(edtR);
this.Controls.Add(this.edtA); Controls.Add(edtA);
this.Controls.Add(this.m_colorSample); Controls.Add(m_colorSample);
this.Controls.Add(this.m_colorTable); Controls.Add(m_colorTable);
this.FillColor = System.Drawing.Color.White; FillColor = Color.White;
this.Name = "UIColorItem"; Name = "UIColorItem";
this.Size = new System.Drawing.Size(476, 233); Size = new Size(476, 233);
this.Style = Sunny.UI.UIStyle.Custom; Style = UIStyle.Custom;
this.ResumeLayout(false); ResumeLayout(false);
this.PerformLayout(); PerformLayout();
} }
private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e) private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e)
@ -524,6 +540,19 @@ namespace Sunny.UI
m_colorWheel.SetLightness(m_colorBar.SelectedHSLColor.Lightness); m_colorWheel.SetLightness(m_colorBar.SelectedHSLColor.Lightness);
} }
private void UpdateInfo()
{
Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor);
string info = string.Format("{0} aRGB({1}, {2}, {3}, {4})", m_colorWheel.SelectedHSLColor.ToString(), c.A, c.R, c.G, c.B);
updateBox = true;
edtA.IntValue = c.A;
edtR.IntValue = c.R;
edtG.IntValue = c.G;
edtB.IntValue = c.B;
//m_infoLabel.Text = info;
updateBox = false;
}
private void m_opacitySlider_SelectedValueChanged(object sender, EventArgs e) private void m_opacitySlider_SelectedValueChanged(object sender, EventArgs e)
{ {
m_opacity = Math.Max(0, m_opacitySlider.Percent); m_opacity = Math.Max(0, m_opacitySlider.Percent);
@ -532,17 +561,6 @@ namespace Sunny.UI
UpdateInfo(); UpdateInfo();
} }
private void UpdateInfo()
{
Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor);
string info = string.Format("{0} aRGB({1}, {2}, {3}, {4})", m_colorWheel.SelectedHSLColor.ToString(), c.A, c.R, c.G, c.B);
edtA.IntValue = c.A;
edtR.IntValue = c.R;
edtG.IntValue = c.G;
edtB.IntValue = c.B;
//m_infoLabel.Text = info;
}
private void m_colorWheel_SelectedColorChanged(object sender, EventArgs e) private void m_colorWheel_SelectedColorChanged(object sender, EventArgs e)
{ {
Color selcol = m_colorWheel.SelectedColor; Color selcol = m_colorWheel.SelectedColor;
@ -558,6 +576,8 @@ namespace Sunny.UI
UpdateInfo(); UpdateInfo();
} }
private bool updateBox = false;
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)
{ {
Close(); Close();
@ -609,5 +629,30 @@ namespace Sunny.UI
edtB.SetStyleColor(uiColor); edtB.SetStyleColor(uiColor);
lblA.ForeColor = lblR.ForeColor = lblG.ForeColor = lblB.ForeColor = uiColor.PanelForeColor; lblA.ForeColor = lblR.ForeColor = lblG.ForeColor = lblB.ForeColor = uiColor.PanelForeColor;
} }
private void edtR_TextChanged(object sender, EventArgs e)
{
if (updateBox) return;
SelectedColor = Color.FromArgb(SelectedColor.A, edtR.IntValue, SelectedColor.G, SelectedColor.B);
}
private void edtG_TextChanged(object sender, EventArgs e)
{
if (updateBox) return;
SelectedColor = Color.FromArgb(SelectedColor.A, SelectedColor.R, edtG.IntValue, SelectedColor.B);
}
private void edtB_TextChanged(object sender, EventArgs e)
{
if (updateBox) return;
SelectedColor = Color.FromArgb(SelectedColor.A, SelectedColor.R, SelectedColor.G, edtB.IntValue);
}
private void edtA_TextChanged(object sender, EventArgs e)
{
if (updateBox) return;
SelectedColor = Color.FromArgb(edtA.IntValue, SelectedColor);
UpdateInfo();
}
} }
} }