diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 1d7b9ee7..ac0cb2b4 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index f53fa7bd..9ae40343 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index 1a55ebee..3552da2c 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index 1d7b9ee7..ac0cb2b4 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Controls/FTextBox.Designer.cs b/SunnyUI.Demo/Controls/FTextBox.Designer.cs index 6f0f56d1..de2fc3cb 100644 --- a/SunnyUI.Demo/Controls/FTextBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FTextBox.Designer.cs @@ -46,11 +46,15 @@ this.uiLine5 = new Sunny.UI.UILine(); this.uiTimePicker1 = new Sunny.UI.UITimePicker(); this.uiLine6 = new Sunny.UI.UILine(); + this.uiLine7 = new Sunny.UI.UILine(); + this.uiColorPicker1 = new Sunny.UI.UIColorPicker(); this.PagePanel.SuspendLayout(); this.SuspendLayout(); // // PagePanel // + this.PagePanel.Controls.Add(this.uiColorPicker1); + this.PagePanel.Controls.Add(this.uiLine7); this.PagePanel.Controls.Add(this.uiLine6); this.PagePanel.Controls.Add(this.uiTimePicker1); this.PagePanel.Controls.Add(this.uiLine5); @@ -94,6 +98,7 @@ this.uiTextBox1.Name = "uiTextBox1"; this.uiTextBox1.Padding = new System.Windows.Forms.Padding(5); this.uiTextBox1.Size = new System.Drawing.Size(221, 29); + this.uiTextBox1.Style = Sunny.UI.UIStyle.Custom; this.uiTextBox1.TabIndex = 3; this.uiTextBox1.Watermark = "水印文字"; // @@ -291,6 +296,7 @@ // // uiTimePicker1 // + this.uiTimePicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; this.uiTimePicker1.FillColor = System.Drawing.Color.White; this.uiTimePicker1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiTimePicker1.Location = new System.Drawing.Point(188, 294); @@ -302,7 +308,7 @@ this.uiTimePicker1.SymbolDropDown = 61555; this.uiTimePicker1.SymbolNormal = 61555; this.uiTimePicker1.TabIndex = 25; - this.uiTimePicker1.Text = "uiTimePicker1"; + this.uiTimePicker1.Text = "23:41:39"; this.uiTimePicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.uiTimePicker1.Value = new System.DateTime(2020, 5, 29, 23, 41, 39, 684); // @@ -317,6 +323,33 @@ this.uiLine6.Text = "UITimePicker"; this.uiLine6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // uiLine7 + // + this.uiLine7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine7.Location = new System.Drawing.Point(30, 342); + this.uiLine7.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine7.Name = "uiLine7"; + this.uiLine7.Size = new System.Drawing.Size(150, 20); + this.uiLine7.TabIndex = 28; + this.uiLine7.Text = "UIColorPicker"; + this.uiLine7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // uiColorPicker1 + // + this.uiColorPicker1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList; + this.uiColorPicker1.FillColor = System.Drawing.Color.White; + this.uiColorPicker1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiColorPicker1.Location = new System.Drawing.Point(30, 376); + this.uiColorPicker1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.uiColorPicker1.MinimumSize = new System.Drawing.Size(63, 0); + this.uiColorPicker1.Name = "uiColorPicker1"; + this.uiColorPicker1.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.uiColorPicker1.Size = new System.Drawing.Size(150, 29); + this.uiColorPicker1.TabIndex = 29; + this.uiColorPicker1.Text = "uiColorPicker1"; + this.uiColorPicker1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + this.uiColorPicker1.Value = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(159)))), ((int)(((byte)(254))))); + // // FTextBox // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); @@ -350,5 +383,7 @@ private UILine uiLine5; private UITimePicker uiTimePicker1; private UILine uiLine6; + private UILine uiLine7; + private UIColorPicker uiColorPicker1; } } \ No newline at end of file diff --git a/SunnyUI.Demo/Controls/FTextBox.cs b/SunnyUI.Demo/Controls/FTextBox.cs index cf3efa47..1509d9b2 100644 --- a/SunnyUI.Demo/Controls/FTextBox.cs +++ b/SunnyUI.Demo/Controls/FTextBox.cs @@ -1,11 +1,4 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; namespace Sunny.UI.Demo { diff --git a/SunnyUI/Controls/Color/UIColorBar.cs b/SunnyUI/Controls/Color/UIColorBar.cs new file mode 100644 index 00000000..98adbb30 --- /dev/null +++ b/SunnyUI/Controls/Color/UIColorBar.cs @@ -0,0 +1,304 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace Sunny.UI +{ + internal class ColorSlider : LabelRotate + { + public event EventHandler SelectedValueChanged; + + private Orientation m_orientation = Orientation.Vertical; + + public Orientation Orientation + { + get { return m_orientation; } + set { m_orientation = value; } + } + + public enum eNumberOfColors + { + Use2Colors, + Use3Colors, + } + + private eNumberOfColors m_numberOfColors = eNumberOfColors.Use3Colors; + + public eNumberOfColors NumberOfColors + { + get { return m_numberOfColors; } + set { m_numberOfColors = value; } + } + + public enum eValueOrientation + { + MinToMax, + MaxToMin, + } + + private eValueOrientation m_valueOrientation = eValueOrientation.MinToMax; + + public eValueOrientation ValueOrientation + { + get { return m_valueOrientation; } + set { m_valueOrientation = value; } + } + + private float m_percent = 0; + + public float Percent + { + get { return m_percent; } + set + { + // ok so it is not really percent, but a value between 0 - 1. + if (value < 0) value = 0; + if (value > 1) value = 1; + if (value != m_percent) + { + m_percent = value; + if (SelectedValueChanged != null) + SelectedValueChanged(this, null); + Invalidate(); + } + } + } + + private Color m_color1 = Color.Black; + private Color m_color2 = Color.FromArgb(255, 127, 127, 127); + private Color m_color3 = Color.White; + + public Color Color1 + { + get { return m_color1; } + set { m_color1 = value; } + } + + public Color Color2 + { + get { return m_color2; } + set { m_color2 = value; } + } + + public Color Color3 + { + get { return m_color3; } + set { m_color3 = value; } + } + + private Padding m_barPadding = new Padding(12, 5, 24, 10); + + public Padding BarPadding + { + get { return m_barPadding; } + set + { + m_barPadding = value; + Invalidate(); + } + } + + public ColorSlider() + { + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + Invalidate(); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + DrawColorBar(e.Graphics); + + if (Focused) + { + RectangleF lr = ClientRectangleF; + lr.Inflate(-2, -2); + ControlPaint.DrawFocusRectangle(e.Graphics, UIColorUtil.Rect(lr)); + } + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + PointF mousepoint = new PointF(e.X, e.Y); + if (e.Button == MouseButtons.Left) + SetPercent(mousepoint); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + Focus(); + PointF mousepoint = new PointF(e.X, e.Y); + if (e.Button == MouseButtons.Left) + SetPercent(mousepoint); + } + + protected override bool ProcessDialogKey(Keys keyData) + { + float percent = Percent * 100; + int step = 0; + if ((keyData & Keys.Up) == Keys.Up) + step = 1; + if ((keyData & Keys.Down) == Keys.Down) + step = -1; + if ((keyData & Keys.Control) == Keys.Control) + step *= 5; + if (step != 0) + { + SetPercent((float)Math.Round(percent + step)); + return true; + } + return base.ProcessDialogKey(keyData); + } + + protected virtual void SetPercent(float percent) + { + Percent = percent / 100; + } + + protected virtual void SetPercent(PointF mousepoint) + { + RectangleF cr = ClientRectangleF; + RectangleF br = BarRectangle; + mousepoint.X += cr.X - br.X; + mousepoint.Y += cr.Y - br.Y; + Percent = GetPercentSet(BarRectangle, Orientation, mousepoint); + Refresh(); + } + + protected RectangleF BarRectangle + { + get + { + RectangleF r = ClientRectangle; + r.X += BarPadding.Left; + r.Width -= BarPadding.Right; + r.Y += BarPadding.Top; + r.Height -= BarPadding.Bottom; + return r; + } + } + + protected float GetPercentSet(RectangleF r, Orientation orientation, PointF mousepoint) + { + float percentSet = 0; + if (orientation == Orientation.Vertical) + { + if (m_valueOrientation == eValueOrientation.MaxToMin) + percentSet = 1 - ((mousepoint.Y - r.Y / r.Height) / r.Height); + else + percentSet = mousepoint.Y / r.Height; + } + if (orientation == Orientation.Horizontal) + if (m_valueOrientation == eValueOrientation.MaxToMin) + percentSet = 1 - ((mousepoint.X - r.X / r.Width) / r.Width); + else + percentSet = (mousepoint.X / r.Width); + if (percentSet < 0) + percentSet = 0; + if (percentSet > 100) + percentSet = 100; + return percentSet; + } + + protected void DrawSelector(Graphics dc, RectangleF r, Orientation orientation, float percentSet) + { + Pen pen = new Pen(Color.CadetBlue); + percentSet = Math.Max(0, percentSet); + percentSet = Math.Min(1, percentSet); + if (orientation == Orientation.Vertical) + { + float selectorY = (float)Math.Floor(r.Top + (r.Height - (r.Height * percentSet))); + if (m_valueOrientation == eValueOrientation.MaxToMin) + selectorY = (float)Math.Floor(r.Top + (r.Height - (r.Height * percentSet))); + else + selectorY = (float)Math.Floor(r.Top + (r.Height * percentSet)); + + dc.DrawLine(pen, r.X, selectorY, r.Right, selectorY); + + Image image = SelectorImages.Image(SelectorImages.eIndexes.Right); + float xpos = r.Right; + float ypos = selectorY - image.Height / 2; + dc.DrawImageUnscaled(image, (int)xpos, (int)ypos); + + image = SelectorImages.Image(SelectorImages.eIndexes.Left); + xpos = r.Left - image.Width; + dc.DrawImageUnscaled(image, (int)xpos, (int)ypos); + } + if (orientation == Orientation.Horizontal) + { + float selectorX = 0; + if (m_valueOrientation == eValueOrientation.MaxToMin) + selectorX = (float)Math.Floor(r.Left + (r.Width - (r.Width * percentSet))); + else + selectorX = (float)Math.Floor(r.Left + (r.Width * percentSet)); + + dc.DrawLine(pen, selectorX, r.Top, selectorX, r.Bottom); + + Image image = SelectorImages.Image(SelectorImages.eIndexes.Up); + float xpos = selectorX - image.Width / 2; + float ypos = r.Bottom; + dc.DrawImageUnscaled(image, (int)xpos, (int)ypos); + + image = SelectorImages.Image(SelectorImages.eIndexes.Down); + ypos = r.Top - image.Height; + dc.DrawImageUnscaled(image, (int)xpos, (int)ypos); + } + } + + protected void DrawColorBar(Graphics dc) + { + RectangleF lr = BarRectangle; + if (m_numberOfColors == eNumberOfColors.Use2Colors) + UIColorUtil.Draw2ColorBar(dc, lr, Orientation, m_color1, m_color2); + else + UIColorUtil.Draw3ColorBar(dc, lr, Orientation, m_color1, m_color2, m_color3); + DrawSelector(dc, lr, Orientation, (float)Percent); + } + } + + internal class HSLColorSlider : ColorSlider + { + private HSLColor m_selectedColor = new HSLColor(); + + public HSLColor SelectedHSLColor + { + get { return m_selectedColor; } + set + { + if (m_selectedColor.Equals(value)) + return; + m_selectedColor = value; + value.Lightness = 0.5; + Color2 = Color.FromArgb(255, value.Color); + Percent = (float)m_selectedColor.Lightness; + Refresh();//Invalidate(UIColorUtil.Rect(BarRectangle)); + } + } + + protected override void SetPercent(PointF mousepoint) + { + base.SetPercent(mousepoint); + m_selectedColor.Lightness = Percent; + Refresh(); + } + + protected override void SetPercent(float percent) + { + base.SetPercent(percent); + m_selectedColor.Lightness = percent / 100; + SelectedHSLColor = m_selectedColor; + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/Color/UIColorTable.cs b/SunnyUI/Controls/Color/UIColorTable.cs new file mode 100644 index 00000000..08333a90 --- /dev/null +++ b/SunnyUI/Controls/Color/UIColorTable.cs @@ -0,0 +1,386 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Reflection; +using System.Windows.Forms; + +namespace Sunny.UI +{ + [ToolboxItem(false)] + public sealed class UIColorTable : LabelRotate + { + public event EventHandler SelectedIndexChanged; + + public Color SelectedItem + { + get + { + if (m_selindex < 0 || m_selindex >= m_colors.Count) + return Color.White; + return m_colors[m_selindex]; + } + set + { + if (m_selindex < m_colors.Count && value == m_colors[m_selindex]) + return; + int index = m_colors.IndexOf(value); + if (index < 0) + return; + SetIndex(index); + } + } + + public bool ColorExist(Color c) + { + int index = m_colors.IndexOf(c); + return index >= 0; + } + + private int m_cols; + private int m_rows; + + public int Cols + { + get { return m_cols; } + set + { + m_cols = value; + m_rows = m_colors.Count / m_cols; + if ((m_colors.Count % m_cols) != 0) + m_rows++; + } + } + + private Size m_fieldSize = new Size(12, 12); + + public Size FieldSize + { + get { return m_fieldSize; } + set { m_fieldSize = value; } + } + + private int CompareColorByValue(Color c1, Color c2) + { + int color1 = c1.R << 16 | c1.G << 8 | c1.B; + int color2 = c2.R << 16 | c2.G << 8 | c2.B; + if (color1 > color2) + return -1; + if (color1 < color2) + return 1; + return 0; + } + + private int CompareColorByHue(Color c1, Color c2) + { + float h1 = c1.GetHue(); + float h2 = c2.GetHue(); + if (h1 < h2) + return -1; + if (h1 > h2) + return 1; + return 0; + } + + private int CompareColorByBrightness(Color c1, Color c2) + { + float h1 = c1.GetBrightness(); + float h2 = c2.GetBrightness(); + if (h1 < h2) + return -1; + if (h1 > h2) + return 1; + return 0; + } + + public void SortColorByValue() + { + m_colors.Sort(CompareColorByValue); + Invalidate(); + } + + public void SortColorByHue() + { + m_colors.Sort(CompareColorByHue); + Invalidate(); + } + + public void SortColorByBrightness() + { + m_colors.Sort(CompareColorByBrightness); + Invalidate(); + } + + private List m_colors = new List(); + + public UIColorTable(Color[] colors) + { + this.DoubleBuffered = true; + if (colors != null) + m_colors = new List(colors); + Cols = 16; + m_initialColorCount = m_colors.Count; + Padding = new Padding(8, 8, 0, 0); + } + + public UIColorTable() + { + this.DoubleBuffered = true; + PropertyInfo[] propinfos = typeof(Color).GetProperties(BindingFlags.Public | BindingFlags.Static); + foreach (PropertyInfo info in propinfos) + { + if (info.PropertyType == typeof(Color)) + { + Color c = (Color)info.GetValue(typeof(Color), null); + if (c.A == 0) // transparent + continue; + m_colors.Add(c); + } + } + m_colors.Sort(CompareColorByBrightness); + m_initialColorCount = m_colors.Count; + Cols = 16; + + Size = new Size(253, 148); + Padding = new Padding(8); + } + + public void RemoveCustomColor() + { + if (m_colors.Count > m_initialColorCount) + m_colors.RemoveAt(m_colors.Count - 1); + } + + public void SetCustomColor(Color col) + { + RemoveCustomColor(); + if (m_colors.Contains(col) == false) + { + int rows = m_rows; + m_colors.Add(col); + Cols = Cols; + if (m_rows != rows) + Invalidate(); + else + Invalidate(GetRectangle(m_colors.Count - 1)); + } + } + + public Color[] Colors + { + get { return m_colors.ToArray(); } + set + { + m_colors = new List(value); + Cols = 16; + m_initialColorCount = m_colors.Count; + } + } + + private int m_spacing = 3; + private int m_selindex; + private int m_initialColorCount; + + private Rectangle GetSelectedItemRect() + { + Rectangle rect = GetRectangle(m_selindex); + rect.Inflate(m_fieldSize.Width / 2, m_fieldSize.Height / 2); + return rect; + } + + private Rectangle GetRectangle(int index) + { + GetRowCol(index, out int row, out int col); + return GetRectangle(row, col); + } + + private void GetRowCol(int index, out int row, out int col) + { + row = index / m_cols; + col = index - (row * m_cols); + } + + private Rectangle GetRectangle(int row, int col) + { + int x = Padding.Left + (col * (m_fieldSize.Width + m_spacing)); + int y = Padding.Top + (row * (m_fieldSize.Height + m_spacing)); + return new Rectangle(x, y, m_fieldSize.Width, m_fieldSize.Height); + } + + private int GetIndexFromMousePos(int x, int y) + { + int col = (x - Padding.Left) / (m_fieldSize.Width + m_spacing); + int row = (y - Padding.Top) / (m_fieldSize.Height + m_spacing); + return GetIndex(row, col); + } + + private int GetIndex(int row, int col) + { + if (col < 0 || col >= m_cols) + return -1; + if (row < 0 || row >= m_rows) + return -1; + return row * m_cols + col; + } + + private void SetIndex(int index) + { + if (index == m_selindex) + return; + Invalidate(GetSelectedItemRect()); + m_selindex = index; + if (SelectedIndexChanged != null) + SelectedIndexChanged(this, null); + Invalidate(GetSelectedItemRect()); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + Focus(); + if (GetSelectedItemRect().Contains(new Point(e.X, e.Y))) + return; + int index = GetIndexFromMousePos(e.X, e.Y); + if (index != -1) + SetIndex(index); + } + + protected override void OnPaint(PaintEventArgs e) + { + Size = new Size(253, 148); + base.OnPaint(e); + int index = 0; + int totalwidth = m_cols * (m_fieldSize.Width + m_spacing); + int totalheight = m_rows * (m_fieldSize.Height + m_spacing); + + int offset = (m_spacing / 2 + 1); + Rectangle r = new Rectangle(0, 0, totalwidth, totalheight); + r.X += Padding.Left - offset; + r.Y += Padding.Top - offset; + e.Graphics.DrawRectangle(Pens.CadetBlue, r); + r.X++; + r.Y++; + r.Width--; + r.Height--; + e.Graphics.FillRectangle(Brushes.White, r); + + for (int col = 1; col < m_cols; col++) + { + int x = Padding.Left - offset + (col * (m_fieldSize.Width + m_spacing)); + e.Graphics.DrawLine(Pens.CadetBlue, x, r.Y, x, r.Bottom - 1); + } + for (int row = 1; row < m_rows; row++) + { + int y = Padding.Top - offset + (row * (m_fieldSize.Height + m_spacing)); + e.Graphics.DrawLine(Pens.CadetBlue, r.X, y, r.Right - 1, y); + } + + for (int row = 0; row < m_rows; row++) + { + for (int col = 0; col < m_cols; col++) + { + if (index >= m_colors.Count) + break; + Rectangle rect = GetRectangle(row, col); + using (SolidBrush brush = new SolidBrush(m_colors[index++])) + { + e.Graphics.FillRectangle(brush, rect); + } + } + } + if (m_selindex >= 0) + { + Rectangle rect = GetSelectedItemRect(); + e.Graphics.FillRectangle(Brushes.White, rect); + rect.Inflate(-3, -3); + using (SolidBrush brush = new SolidBrush(SelectedItem)) + { + e.Graphics.FillRectangle(brush, rect); + } + if (Focused) + { + rect.Inflate(2, 2); + ControlPaint.DrawFocusRectangle(e.Graphics, rect); + } + else + { + rect.X -= 2; + rect.Y -= 2; + rect.Width += 3; + rect.Height += 3; + e.Graphics.DrawRectangle(Pens.CadetBlue, rect); + } + } + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + Invalidate(); + } + + protected override bool ProcessDialogKey(Keys keyData) + { + bool processed = false; + GetRowCol(m_selindex, out int row, out int col); + + switch (keyData) + { + case Keys.Down: + row++; + processed = true; + break; + + case Keys.Up: + row--; + processed = true; + break; + + case Keys.Left: + col--; + if (col < 0) + { + col = m_cols - 1; + row--; + } + processed = true; + break; + + case Keys.Right: + col++; + if (col >= m_cols) + { + col = 0; + row++; + } + processed = true; + break; + } + if (processed) + { + int index = GetIndex(row, col); + if (index != -1) + SetIndex(index); + return false; + } + return base.ProcessDialogKey(keyData); + } + + private void InitializeComponent() + { + this.SuspendLayout(); + // + // UIColorTable + // + this.Size = new System.Drawing.Size(253, 148); + this.ResumeLayout(false); + + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/Color/UIColorTable.resx b/SunnyUI/Controls/Color/UIColorTable.resx new file mode 100644 index 00000000..e5858cc2 --- /dev/null +++ b/SunnyUI/Controls/Color/UIColorTable.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file diff --git a/SunnyUI/Controls/Color/UIColorWheel.cs b/SunnyUI/Controls/Color/UIColorWheel.cs new file mode 100644 index 00000000..b908a9d7 --- /dev/null +++ b/SunnyUI/Controls/Color/UIColorWheel.cs @@ -0,0 +1,308 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace Sunny.UI +{ + [ToolboxItem(false)] + public sealed class UIColorWheel : Control, IStyleInterface + { + public event EventHandler SelectedColorChanged; + + private Color m_frameColor = UIColor.Blue; + private HSLColor m_selectedColor = new HSLColor(Color.BlanchedAlmond); + private PathGradientBrush m_brush; + private readonly List m_path = new List(); + private readonly List m_colors = new List(); + private double m_wheelLightness = 0.5; + + public HSLColor SelectedHSLColor + { + get { return m_selectedColor; } + set + { + if (m_selectedColor.Equals(value)) + return; + Invalidate(UIColorUtil.Rect(ColorSelectorRectangle)); + m_selectedColor = value; + SelectedColorChanged?.Invoke(this, null); + Refresh();//Invalidate(UIColorUtil.Rect(ColorSelectorRectangle)); + } + } + + public void SetLightness(double lightness) + { + m_selectedColor.Lightness = lightness; + Invalidate(UIColorUtil.Rect(ColorSelectorRectangle)); + SelectedColorChanged?.Invoke(this, null); + Refresh();//Invalidate(UIColorUtil.Rect(ColorSelectorRectangle)); + } + + public Color SelectedColor + { + get { return m_selectedColor.Color; } + set + { + if (m_selectedColor.Color != value) + SelectedHSLColor = new HSLColor(value); + } + } + + public Color FrameColor + { + get => m_frameColor; + set + { + m_frameColor = value; + Invalidate(); + } + } + + public UIColorWheel() + { + SetStyle(ControlStyles.SupportsTransparentBackColor, true); + DoubleBuffered = true; + SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); + Width = Height = 148; + Version = UIGlobal.Version; + } + + protected override void OnGotFocus(EventArgs e) + { + base.OnGotFocus(e); + Invalidate(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + Invalidate(); + } + + protected override void OnPaint(PaintEventArgs e) + { + if (Width != Height) + { + Height = Width; + } + + using (SolidBrush b = new SolidBrush(BackColor)) + { + e.Graphics.FillRectangle(b, ClientRectangle); + } + + RectangleF wheelRectangle = WheelRectangle; + UIColorUtil.DrawFrame(e.Graphics, wheelRectangle, 6, m_frameColor); + wheelRectangle = ColorWheelRectangle; + PointF center = UIColorUtil.Center(wheelRectangle); + e.Graphics.SmoothingMode = SmoothingMode.HighSpeed; + if (m_brush == null) + { + m_brush = new PathGradientBrush(m_path.ToArray(), WrapMode.Clamp); + m_brush.CenterPoint = center; + m_brush.CenterColor = Color.White; + m_brush.SurroundColors = m_colors.ToArray(); + } + + e.Graphics.FillPie(m_brush, UIColorUtil.Rect(wheelRectangle), 0, 360); + e.Graphics.DrawEllipse(BackColor, wheelRectangle); + + DrawColorSelector(e.Graphics); + + if (Focused) + { + RectangleF r = WheelRectangle; + r.Inflate(-2, -2); + ControlPaint.DrawFocusRectangle(e.Graphics, UIColorUtil.Rect(r)); + } + + e.Graphics.Smooth(false); + } + + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + m_brush?.Dispose(); + m_brush = null; + ReCalcWheelPoints(); + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + PointF mousePoint = new PointF(e.X, e.Y); + if (e.Button == MouseButtons.Left) + SetColor(mousePoint); + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + Focus(); + PointF mousePoint = new PointF(e.X, e.Y); + if (e.Button == MouseButtons.Left) + SetColor(mousePoint); + } + + protected override bool ProcessDialogKey(Keys keyData) + { + HSLColor c = SelectedHSLColor; + double hue = c.Hue; + int step = 1; + if ((keyData & Keys.Control) == Keys.Control) step = 5; + if ((keyData & Keys.Up) == Keys.Up) hue += step; + if ((keyData & Keys.Down) == Keys.Down) hue -= step; + if (hue >= 360) hue = 0; + if (hue < 0) hue = 359; + + if (hue != c.Hue) + { + c.Hue = hue; + SelectedHSLColor = c; + return true; + } + + return base.ProcessDialogKey(keyData); + } + + private RectangleF ColorSelectorRectangle + { + get + { + HSLColor color = m_selectedColor; + double angleR = color.Hue * Math.PI / 180; + PointF center = UIColorUtil.Center(ColorWheelRectangle); + double radius = Radius(ColorWheelRectangle); + radius *= color.Saturation; + double x = center.X + Math.Cos(angleR) * radius; + double y = center.Y - Math.Sin(angleR) * radius; + Rectangle selectorRectangle = new Rectangle(new Point((int)x, (int)y), new Size(0, 0)); + selectorRectangle.Inflate(12, 12); + return selectorRectangle; + } + } + + private void DrawColorSelector(Graphics dc) + { + Rectangle r = UIColorUtil.Rect(ColorSelectorRectangle); + PointF center = UIColorUtil.Center(r); + Image image = SelectorImages.Image(SelectorImages.eIndexes.Donut); + dc.DrawImageUnscaled(image, (int)(center.X - image.Width / 2.0), (int)(center.Y - image.Height / 2.0)); + } + + private RectangleF WheelRectangle + { + get + { + Rectangle r = ClientRectangle; + r.Width -= 1; + r.Height -= 1; + return r; + } + } + + private RectangleF ColorWheelRectangle + { + get + { + RectangleF r = WheelRectangle; + r.Inflate(-5, -5); + return r; + } + } + + private float Radius(RectangleF r) + { + return Math.Min((r.Width / 2), (r.Height / 2)); + } + + private void ReCalcWheelPoints() + { + m_path.Clear(); + m_colors.Clear(); + + PointF center = UIColorUtil.Center(ColorWheelRectangle); + float radius = Radius(ColorWheelRectangle); + double angle = 0; + double fullCircle = 360; + double step = 5; + while (angle < fullCircle) + { + double angleR = angle * (Math.PI / 180); + double x = center.X + Math.Cos(angleR) * radius; + double y = center.Y - Math.Sin(angleR) * radius; + m_path.Add(new PointF((float)x, (float)y)); + m_colors.Add(new HSLColor(angle, 1, m_wheelLightness).Color); + angle += step; + } + } + + private void SetColor(PointF mousePoint) + { + if (WheelRectangle.Contains(mousePoint) == false) + return; + + PointF center = UIColorUtil.Center(ColorWheelRectangle); + double radius = Radius(ColorWheelRectangle); + double dx = Math.Abs(mousePoint.X - center.X); + double dy = Math.Abs(mousePoint.Y - center.Y); + double angle = Math.Atan(dy / dx) / Math.PI * 180; + double dist = Math.Pow((Math.Pow(dx, 2) + (Math.Pow(dy, 2))), 0.5); + double saturation = dist / radius; + //if (dist > radius + 5) // give 5 pixels slack + // return; + if (dist < 6) + saturation = 0; // snap to center + + if (mousePoint.X < center.X) + angle = 180 - angle; + if (mousePoint.Y > center.Y) + angle = 360 - angle; + + SelectedHSLColor = new HSLColor(angle, saturation, SelectedHSLColor.Lightness); + } + + private UIStyle _style = UIStyle.Blue; + + /// + /// ʽ + /// + [DefaultValue(UIStyle.Blue)] + public UIStyle Style + { + get => _style; + set => SetStyle(value); + } + + /// + /// ʽ + /// + /// ʽ + public void SetStyle(UIStyle style) + { + SetStyleColor(UIStyles.GetStyleColor(style)); + _style = style; + } + + /// + /// ʽɫ + /// + /// + public void SetStyleColor(UIBaseStyle uiColor) + { + if (uiColor.IsCustom()) return; + FrameColor = uiColor.RectColor; + BackColor = uiColor.PlainColor; + Invalidate(); + } + + public bool StyleCustomMode { get; set; } + + public string Version { get; } + + public string TagString { get; set; } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/Color/UIHSLColor.cs b/SunnyUI/Controls/Color/UIHSLColor.cs new file mode 100644 index 00000000..dbf1094c --- /dev/null +++ b/SunnyUI/Controls/Color/UIHSLColor.cs @@ -0,0 +1,328 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace Sunny.UI +{ + public struct HSLColor + { + private double m_hue; + private double m_saturation; + private double m_lightness; + // http://en.wikipedia.org/wiki/HSL_color_space + + public double Hue + { + get { return m_hue; } + set { m_hue = value; } + } + + public double Saturation + { + get { return m_saturation; } + set { m_saturation = value; } + } + + public double Lightness + { + get { return m_lightness; } + set + { + m_lightness = value; + if (m_lightness < 0) + m_lightness = 0; + if (m_lightness > 1) + m_lightness = 1; + } + } + + public HSLColor(double hue, double saturation, double lightness) + { + m_hue = Math.Min(360, hue); + m_saturation = Math.Min(1, saturation); + m_lightness = Math.Min(1, lightness); + } + + public HSLColor(Color color) + { + m_hue = 0; + m_saturation = 1; + m_lightness = 1; + FromRGB(color); + } + + public Color Color + { + get { return ToRGB(); } + set { FromRGB(value); } + } + + private void FromRGB(Color cc) + { + double r = (double)cc.R / 255d; + double g = (double)cc.G / 255d; + double b = (double)cc.B / 255d; + + double min = Math.Min(Math.Min(r, g), b); + double max = Math.Max(Math.Max(r, g), b); + // calulate hue according formula given in + // "Conversion from RGB to HSL or HSV" + m_hue = 0; + if (min != max) + { + if (r == max && g >= b) + { + m_hue = 60 * ((g - b) / (max - min)) + 0; + } + else + if (r == max && g < b) + { + m_hue = 60 * ((g - b) / (max - min)) + 360; + } + else + if (g == max) + { + m_hue = 60 * ((b - r) / (max - min)) + 120; + } + else + if (b == max) + { + m_hue = 60 * ((r - g) / (max - min)) + 240; + } + } + // find lightness + m_lightness = (min + max) / 2; + + // find saturation + if (m_lightness == 0 || min == max) + m_saturation = 0; + else + if (m_lightness > 0 && m_lightness <= 0.5) + m_saturation = (max - min) / (2 * m_lightness); + else + if (m_lightness > 0.5) + m_saturation = (max - min) / (2 - 2 * m_lightness); + } + + private Color ToRGB() + { + // convert to RGB according to + // "Conversion from HSL to RGB" + + double r = m_lightness; + double g = m_lightness; + double b = m_lightness; + if (m_saturation == 0) + return Color.FromArgb(255, (int)(r * 255), (int)(g * 255), (int)(b * 255)); + + double q = 0; + if (m_lightness < 0.5) + q = m_lightness * (1 + m_saturation); + else + q = m_lightness + m_saturation - (m_lightness * m_saturation); + double p = 2 * m_lightness - q; + double hk = m_hue / 360; + + // r,g,b colors + double[] tc = new double[3] { hk + (1d / 3d), hk, hk - (1d / 3d) }; + double[] colors = new double[3] { 0, 0, 0 }; + + for (int color = 0; color < colors.Length; color++) + { + if (tc[color] < 0) + tc[color] += 1; + if (tc[color] > 1) + tc[color] -= 1; + + if (tc[color] < (1d / 6d)) + colors[color] = p + ((q - p) * 6 * tc[color]); + else + if (tc[color] >= (1d / 6d) && tc[color] < (1d / 2d)) + colors[color] = q; + else + if (tc[color] >= (1d / 2d) && tc[color] < (2d / 3d)) + colors[color] = p + ((q - p) * 6 * (2d / 3d - tc[color])); + else + colors[color] = p; + + colors[color] *= 255; // convert to value expected by Color + } + return Color.FromArgb(255, (int)colors[0], (int)colors[1], (int)colors[2]); + } + + public bool Equals(HSLColor color) + { + return Hue == color.Hue && Lightness == color.Lightness && Saturation == color.Saturation; + } + + public override string ToString() + { + string s = string.Format("HSL({0:f2}, {1:f2}, {2:f2})", Hue, Saturation, Lightness); + return s; + } + } + + public static class UIColorUtil + { + 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 = r.X; + rf.Y = r.Y; + rf.Width = r.Width; + rf.Height = 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(); + } + } + } + + internal class SelectorImages + { + public enum eIndexes + { + Right, + Left, + Up, + Down, + Donut, + } + + private static ImageList m_imageList; + + public static ImageList ImageList() + { + Type t = typeof(SelectorImages); + if (m_imageList == null) + m_imageList = ImageEx.GetToolbarImageList(t, Properties.Resources.colorbarIndicators, new Size(12, 12), Color.Magenta); + return m_imageList; + } + + public static Image Image(eIndexes index) + { + return ImageList().Images[(int)index]; + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/Color/UILabelRotate.cs b/SunnyUI/Controls/Color/UILabelRotate.cs new file mode 100644 index 00000000..67dae1a9 --- /dev/null +++ b/SunnyUI/Controls/Color/UILabelRotate.cs @@ -0,0 +1,231 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace Sunny.UI +{ + [ToolboxItem(false)] + public class LabelRotate : Control, IStyleInterface + { + private float m_textAngle = 0; + private ContentAlignment m_rotatePointAlignment = ContentAlignment.MiddleCenter; + private ContentAlignment m_textAlignment = ContentAlignment.MiddleLeft; + + public new string Text + { + get { return base.Text; } + set + { + base.Text = value; + Refresh(); + } + } + + public float TextAngle + { + get { return m_textAngle; } + set + { + m_textAngle = value; + Invalidate(); + } + } + + public ContentAlignment TextAlign + { + get { return m_textAlignment; } + set + { + m_textAlignment = value; + Invalidate(); + } + } + + public ContentAlignment RotatePointAlignment + { + get { return m_rotatePointAlignment; } + set + { + m_rotatePointAlignment = value; + Invalidate(); + } + } + + private Color m_frameColor = UIColor.Blue; + + public Color FrameColor + { + get => m_frameColor; + set + { + m_frameColor = value; + Invalidate(); + } + } + + public LabelRotate() + { + SetStyle(ControlStyles.SupportsTransparentBackColor, true); + this.Text = string.Empty; + base.DoubleBuffered = true; + this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); + Version = UIGlobal.Version; + } + + protected override void OnPaint(PaintEventArgs e) + { + using (SolidBrush b = new SolidBrush(BackColor)) + { + e.Graphics.FillRectangle(b, ClientRectangle); + } + + RectangleF lr = ClientRectangleF; + UIColorUtil.DrawFrame(e.Graphics, lr, 6, m_frameColor); + if (Text.Length > 0) + { + StringFormat format = new StringFormat(); + string alignment = TextAlign.ToString(); + + if (((int)TextAlign & (int)(ContentAlignment.BottomLeft | ContentAlignment.MiddleLeft | ContentAlignment.TopLeft)) != 0) + format.Alignment = StringAlignment.Near; + + if (((int)TextAlign & (int)(ContentAlignment.BottomCenter | ContentAlignment.MiddleCenter | ContentAlignment.TopCenter)) != 0) + format.Alignment = StringAlignment.Center; + + if (((int)TextAlign & (int)(ContentAlignment.BottomRight | ContentAlignment.MiddleRight | ContentAlignment.TopRight)) != 0) + format.Alignment = StringAlignment.Far; + + if (((int)TextAlign & (int)(ContentAlignment.BottomLeft | ContentAlignment.BottomCenter | ContentAlignment.BottomRight)) != 0) + format.LineAlignment = StringAlignment.Far; + + if (((int)TextAlign & (int)(ContentAlignment.MiddleLeft | ContentAlignment.MiddleCenter | ContentAlignment.MiddleRight)) != 0) + format.LineAlignment = StringAlignment.Center; + + if (((int)TextAlign & (int)(ContentAlignment.TopLeft | ContentAlignment.TopCenter | ContentAlignment.TopRight)) != 0) + format.LineAlignment = StringAlignment.Near; + + Rectangle r = ClientRectangle; + r.X += Padding.Left; + r.Y += Padding.Top; + r.Width -= Padding.Right; + r.Height -= Padding.Bottom; + + using (SolidBrush b = new SolidBrush(ForeColor)) + { + if (TextAngle == 0) + { + e.Graphics.DrawString(Text, Font, b, r, format); + } + else + { + PointF center = UIColorUtil.Center(ClientRectangle); + switch (RotatePointAlignment) + { + case ContentAlignment.TopLeft: + center.X = r.Left; + center.Y = r.Top; + break; + + case ContentAlignment.TopCenter: + center.Y = r.Top; + break; + + case ContentAlignment.TopRight: + center.X = r.Right; + center.Y = r.Top; + break; + + case ContentAlignment.MiddleLeft: + center.X = r.Left; + break; + + case ContentAlignment.MiddleCenter: + break; + + case ContentAlignment.MiddleRight: + center.X = r.Right; + break; + + case ContentAlignment.BottomLeft: + center.X = r.Left; + center.Y = r.Bottom; + break; + + case ContentAlignment.BottomCenter: + center.Y = r.Bottom; + break; + + case ContentAlignment.BottomRight: + center.X = r.Right; + center.Y = r.Bottom; + break; + } + center.X += Padding.Left; + center.Y += Padding.Top; + center.X -= Padding.Right; + center.Y -= Padding.Bottom; + + e.Graphics.TranslateTransform(center.X, center.Y); + e.Graphics.RotateTransform(TextAngle); + + e.Graphics.DrawString(Text, Font, b, new PointF(0, 0), format); + e.Graphics.ResetTransform(); + } + } + } + + RaisePaintEvent(this, e); + } + + protected RectangleF ClientRectangleF + { + get + { + RectangleF r = ClientRectangle; + r.Width -= 1; + r.Height -= 1; + return r; + } + } + + private UIStyle _style = UIStyle.Blue; + + /// + /// ʽ + /// + [DefaultValue(UIStyle.Blue)] + public UIStyle Style + { + get => _style; + set => SetStyle(value); + } + + /// + /// ʽ + /// + /// ʽ + public void SetStyle(UIStyle style) + { + SetStyleColor(UIStyles.GetStyleColor(style)); + _style = style; + } + + /// + /// ʽɫ + /// + /// + public virtual void SetStyleColor(UIBaseStyle uiColor) + { + if (uiColor.IsCustom()) return; + FrameColor = uiColor.RectColor; + ForeColor = uiColor.PanelForeColor; + Invalidate(); + } + + public bool StyleCustomMode { get; set; } + + public string Version { get; } + + public string TagString { get; set; } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIColorItem.cs b/SunnyUI/Controls/DropItem/UIColorItem.cs new file mode 100644 index 00000000..6b31ec10 --- /dev/null +++ b/SunnyUI/Controls/DropItem/UIColorItem.cs @@ -0,0 +1,599 @@ +using System; +using System.Drawing; + +namespace Sunny.UI +{ + public sealed class UIColorItem : UIDropDownItem + { + public UIColorItem() + { + InitializeComponent(); + } + + private LabelRotate m_colorSample; + private UITextBox edtA; + private UITextBox edtR; + private UITextBox edtG; + private UITextBox edtB; + private UILabel lblA; + private UILabel lblR; + private UILabel lblG; + private UILabel lblB; + private UIColorWheel m_colorWheel; + private HSLColorSlider m_colorBar; + private ColorSlider m_opacitySlider; + private UISymbolButton btnOK; + private UISymbolButton btnCancel; + private UIColorTable m_colorTable; + + private void InitializeComponent() + { + this.m_colorTable = new Sunny.UI.UIColorTable(); + this.m_colorSample = new Sunny.UI.LabelRotate(); + this.edtA = new Sunny.UI.UITextBox(); + this.edtR = new Sunny.UI.UITextBox(); + this.edtG = new Sunny.UI.UITextBox(); + this.edtB = new Sunny.UI.UITextBox(); + this.lblA = new Sunny.UI.UILabel(); + this.lblR = new Sunny.UI.UILabel(); + this.lblG = new Sunny.UI.UILabel(); + this.lblB = new Sunny.UI.UILabel(); + this.m_colorWheel = new Sunny.UI.UIColorWheel(); + this.m_colorBar = new Sunny.UI.HSLColorSlider(); + this.m_opacitySlider = new Sunny.UI.ColorSlider(); + this.btnOK = new Sunny.UI.UISymbolButton(); + this.btnCancel = new Sunny.UI.UISymbolButton(); + this.SuspendLayout(); + // + // m_colorTable + // + this.m_colorTable.BackColor = System.Drawing.Color.Transparent; + this.m_colorTable.Colors = new System.Drawing.Color[] { + System.Drawing.Color.Black, + System.Drawing.Color.DarkGreen, + System.Drawing.Color.DarkSlateGray, + System.Drawing.Color.Purple, + System.Drawing.Color.Maroon, + System.Drawing.Color.Teal, + System.Drawing.Color.Green, + System.Drawing.Color.Olive, + System.Drawing.Color.Navy, + System.Drawing.Color.Indigo, + System.Drawing.Color.MidnightBlue, + System.Drawing.Color.DarkRed, + System.Drawing.Color.DarkMagenta, + System.Drawing.Color.DarkBlue, + System.Drawing.Color.DarkCyan, + System.Drawing.Color.DarkOliveGreen, + System.Drawing.Color.SaddleBrown, + System.Drawing.Color.ForestGreen, + System.Drawing.Color.OliveDrab, + System.Drawing.Color.SeaGreen, + System.Drawing.Color.DarkGoldenrod, + System.Drawing.Color.DarkSlateBlue, + System.Drawing.Color.MediumBlue, + System.Drawing.Color.Sienna, + System.Drawing.Color.Brown, + System.Drawing.Color.DarkTurquoise, + System.Drawing.Color.DimGray, + System.Drawing.Color.LightSeaGreen, + System.Drawing.Color.DarkViolet, + System.Drawing.Color.Firebrick, + System.Drawing.Color.MediumVioletRed, + System.Drawing.Color.MediumSeaGreen, + System.Drawing.Color.Crimson, + System.Drawing.Color.Chocolate, + System.Drawing.Color.MediumSpringGreen, + System.Drawing.Color.Goldenrod, + System.Drawing.Color.SteelBlue, + System.Drawing.Color.LawnGreen, + System.Drawing.Color.DarkOrchid, + System.Drawing.Color.Orange, + System.Drawing.Color.LimeGreen, + System.Drawing.Color.Yellow, + System.Drawing.Color.Gold, + System.Drawing.Color.Red, + System.Drawing.Color.Magenta, + System.Drawing.Color.Lime, + System.Drawing.Color.SpringGreen, + System.Drawing.Color.YellowGreen, + System.Drawing.Color.Chartreuse, + System.Drawing.Color.DeepSkyBlue, + System.Drawing.Color.Aqua, + System.Drawing.Color.OrangeRed, + System.Drawing.Color.Blue, + System.Drawing.Color.DarkOrange, + System.Drawing.Color.CadetBlue, + System.Drawing.Color.Cyan, + System.Drawing.Color.Fuchsia, + System.Drawing.Color.Gray, + System.Drawing.Color.SlateGray, + System.Drawing.Color.Peru, + System.Drawing.Color.BlueViolet, + System.Drawing.Color.LightSlateGray, + System.Drawing.Color.DeepPink, + System.Drawing.Color.MediumTurquoise, + System.Drawing.Color.DodgerBlue, + System.Drawing.Color.Turquoise, + System.Drawing.Color.RoyalBlue, + System.Drawing.Color.SlateBlue, + System.Drawing.Color.MediumOrchid, + System.Drawing.Color.DarkKhaki, + System.Drawing.Color.IndianRed, + System.Drawing.Color.GreenYellow, + System.Drawing.Color.MediumAquamarine, + System.Drawing.Color.Tomato, + System.Drawing.Color.DarkSeaGreen, + System.Drawing.Color.Orchid, + System.Drawing.Color.RosyBrown, + System.Drawing.Color.PaleVioletRed, + System.Drawing.Color.MediumPurple, + System.Drawing.Color.Coral, + System.Drawing.Color.CornflowerBlue, + System.Drawing.Color.DarkGray, + System.Drawing.Color.SandyBrown, + System.Drawing.Color.MediumSlateBlue, + System.Drawing.Color.Tan, + System.Drawing.Color.DarkSalmon, + System.Drawing.Color.BurlyWood, + System.Drawing.Color.HotPink, + System.Drawing.Color.Salmon, + System.Drawing.Color.Violet, + System.Drawing.Color.LightCoral, + System.Drawing.Color.SkyBlue, + System.Drawing.Color.LightSalmon, + System.Drawing.Color.Khaki, + System.Drawing.Color.Plum, + System.Drawing.Color.LightGreen, + System.Drawing.Color.Aquamarine, + System.Drawing.Color.Silver, + System.Drawing.Color.LightSkyBlue, + System.Drawing.Color.LightSteelBlue, + System.Drawing.Color.LightBlue, + System.Drawing.Color.PaleGreen, + System.Drawing.Color.PowderBlue, + System.Drawing.Color.Thistle, + System.Drawing.Color.PaleGoldenrod, + System.Drawing.Color.PaleTurquoise, + System.Drawing.Color.LightGray, + System.Drawing.Color.Wheat, + System.Drawing.Color.NavajoWhite, + System.Drawing.Color.Moccasin, + System.Drawing.Color.LightPink, + System.Drawing.Color.PeachPuff, + System.Drawing.Color.Gainsboro, + System.Drawing.Color.Pink, + System.Drawing.Color.Bisque, + System.Drawing.Color.LightGoldenrodYellow, + System.Drawing.Color.LemonChiffon, + System.Drawing.Color.BlanchedAlmond, + System.Drawing.Color.Beige, + System.Drawing.Color.AntiqueWhite, + System.Drawing.Color.PapayaWhip, + System.Drawing.Color.Cornsilk, + System.Drawing.Color.LightYellow, + System.Drawing.Color.LightCyan, + System.Drawing.Color.Lavender, + System.Drawing.Color.Linen, + System.Drawing.Color.MistyRose, + System.Drawing.Color.OldLace, + System.Drawing.Color.WhiteSmoke, + System.Drawing.Color.SeaShell, + System.Drawing.Color.Azure, + System.Drawing.Color.Honeydew, + System.Drawing.Color.Ivory, + System.Drawing.Color.LavenderBlush, + System.Drawing.Color.FloralWhite, + System.Drawing.Color.AliceBlue, + System.Drawing.Color.MintCream, + System.Drawing.Color.GhostWhite, + System.Drawing.Color.Snow, + System.Drawing.Color.White}; + this.m_colorTable.Cols = 16; + 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))))); + this.m_colorTable.Location = new System.Drawing.Point(10, 8); + this.m_colorTable.Name = "m_colorTable"; + this.m_colorTable.Padding = new System.Windows.Forms.Padding(8); + this.m_colorTable.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter; + this.m_colorTable.SelectedItem = System.Drawing.Color.Black; + this.m_colorTable.Size = new System.Drawing.Size(253, 148); + this.m_colorTable.Style = Sunny.UI.UIStyle.Custom; + this.m_colorTable.StyleCustomMode = false; + this.m_colorTable.TabIndex = 0; + this.m_colorTable.TagString = null; + this.m_colorTable.Text = "colorTable1"; + this.m_colorTable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_colorTable.TextAngle = 0F; + this.m_colorTable.SelectedIndexChanged += new System.EventHandler(this.m_colorTable_SelectedIndexChanged); + // + // m_colorSample + // + this.m_colorSample.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.m_colorSample.Location = new System.Drawing.Point(10, 163); + this.m_colorSample.Name = "m_colorSample"; + this.m_colorSample.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter; + this.m_colorSample.Size = new System.Drawing.Size(253, 26); + this.m_colorSample.Style = Sunny.UI.UIStyle.Custom; + this.m_colorSample.StyleCustomMode = false; + this.m_colorSample.TabIndex = 1; + this.m_colorSample.TabStop = false; + this.m_colorSample.TagString = null; + this.m_colorSample.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_colorSample.TextAngle = 0F; + this.m_colorSample.Paint += new System.Windows.Forms.PaintEventHandler(this.m_colorSample_Paint); + // + // edtA + // + this.edtA.Cursor = System.Windows.Forms.Cursors.IBeam; + this.edtA.FillColor = System.Drawing.Color.White; + this.edtA.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.edtA.HasMaximum = true; + this.edtA.HasMinimum = true; + this.edtA.Location = new System.Drawing.Point(29, 197); + this.edtA.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.edtA.Maximum = 255D; + this.edtA.Minimum = 0D; + this.edtA.Name = "edtA"; + this.edtA.Padding = new System.Windows.Forms.Padding(5); + this.edtA.Size = new System.Drawing.Size(41, 26); + this.edtA.Style = Sunny.UI.UIStyle.Custom; + this.edtA.TabIndex = 2; + this.edtA.Text = "0"; + this.edtA.Type = Sunny.UI.UITextBox.UIEditType.Integer; + // + // edtR + // + this.edtR.Cursor = System.Windows.Forms.Cursors.IBeam; + this.edtR.FillColor = System.Drawing.Color.White; + this.edtR.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.edtR.HasMaximum = true; + this.edtR.HasMinimum = true; + this.edtR.Location = new System.Drawing.Point(93, 197); + this.edtR.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.edtR.Maximum = 255D; + this.edtR.Minimum = 0D; + this.edtR.Name = "edtR"; + this.edtR.Padding = new System.Windows.Forms.Padding(5); + this.edtR.Size = new System.Drawing.Size(41, 26); + this.edtR.Style = Sunny.UI.UIStyle.Custom; + this.edtR.TabIndex = 3; + this.edtR.Text = "0"; + this.edtR.Type = Sunny.UI.UITextBox.UIEditType.Integer; + // + // edtG + // + this.edtG.Cursor = System.Windows.Forms.Cursors.IBeam; + this.edtG.FillColor = System.Drawing.Color.White; + this.edtG.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.edtG.HasMaximum = true; + this.edtG.HasMinimum = true; + this.edtG.Location = new System.Drawing.Point(158, 197); + this.edtG.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.edtG.Maximum = 255D; + this.edtG.Minimum = 0D; + this.edtG.Name = "edtG"; + this.edtG.Padding = new System.Windows.Forms.Padding(5); + this.edtG.Size = new System.Drawing.Size(41, 26); + this.edtG.Style = Sunny.UI.UIStyle.Custom; + this.edtG.TabIndex = 4; + this.edtG.Text = "0"; + this.edtG.Type = Sunny.UI.UITextBox.UIEditType.Integer; + // + // edtB + // + this.edtB.Cursor = System.Windows.Forms.Cursors.IBeam; + this.edtB.FillColor = System.Drawing.Color.White; + this.edtB.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.edtB.HasMaximum = true; + this.edtB.HasMinimum = true; + this.edtB.Location = new System.Drawing.Point(222, 197); + this.edtB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.edtB.Maximum = 255D; + this.edtB.Minimum = 0D; + this.edtB.Name = "edtB"; + this.edtB.Padding = new System.Windows.Forms.Padding(5); + this.edtB.Size = new System.Drawing.Size(41, 26); + this.edtB.Style = Sunny.UI.UIStyle.Custom; + this.edtB.TabIndex = 5; + this.edtB.Text = "0"; + this.edtB.Type = Sunny.UI.UITextBox.UIEditType.Integer; + // + // lblA + // + this.lblA.AutoSize = true; + this.lblA.BackColor = System.Drawing.Color.Transparent; + this.lblA.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblA.Location = new System.Drawing.Point(9, 200); + this.lblA.Name = "lblA"; + this.lblA.Size = new System.Drawing.Size(19, 20); + this.lblA.Style = Sunny.UI.UIStyle.Custom; + this.lblA.TabIndex = 6; + this.lblA.Text = "A"; + this.lblA.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblR + // + this.lblR.AutoSize = true; + this.lblR.BackColor = System.Drawing.Color.Transparent; + this.lblR.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblR.Location = new System.Drawing.Point(74, 200); + this.lblR.Name = "lblR"; + this.lblR.Size = new System.Drawing.Size(18, 20); + this.lblR.Style = Sunny.UI.UIStyle.Custom; + this.lblR.TabIndex = 7; + this.lblR.Text = "R"; + this.lblR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblG + // + this.lblG.AutoSize = true; + this.lblG.BackColor = System.Drawing.Color.Transparent; + this.lblG.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblG.Location = new System.Drawing.Point(138, 200); + this.lblG.Name = "lblG"; + this.lblG.Size = new System.Drawing.Size(19, 20); + this.lblG.Style = Sunny.UI.UIStyle.Custom; + this.lblG.TabIndex = 8; + this.lblG.Text = "G"; + this.lblG.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblB + // + this.lblB.AutoSize = true; + this.lblB.BackColor = System.Drawing.Color.Transparent; + this.lblB.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblB.Location = new System.Drawing.Point(203, 200); + this.lblB.Name = "lblB"; + this.lblB.Size = new System.Drawing.Size(18, 20); + this.lblB.Style = Sunny.UI.UIStyle.Custom; + this.lblB.TabIndex = 9; + this.lblB.Text = "B"; + this.lblB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // m_colorWheel + // + this.m_colorWheel.BackColor = System.Drawing.Color.Transparent; + this.m_colorWheel.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.m_colorWheel.Location = new System.Drawing.Point(269, 8); + this.m_colorWheel.Name = "m_colorWheel"; + this.m_colorWheel.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(235)))), ((int)(((byte)(205))))); + this.m_colorWheel.Size = new System.Drawing.Size(148, 148); + this.m_colorWheel.Style = Sunny.UI.UIStyle.Custom; + this.m_colorWheel.StyleCustomMode = false; + this.m_colorWheel.TabIndex = 10; + this.m_colorWheel.TagString = null; + this.m_colorWheel.Text = "colorWheel1"; + this.m_colorWheel.SelectedColorChanged += new System.EventHandler(this.m_colorWheel_SelectedColorChanged); + // + // m_colorBar + // + this.m_colorBar.BackColor = System.Drawing.Color.Transparent; + this.m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10); + this.m_colorBar.Color1 = System.Drawing.Color.Black; + this.m_colorBar.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(127)))), ((int)(((byte)(127))))); + this.m_colorBar.Color3 = System.Drawing.Color.White; + this.m_colorBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.m_colorBar.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.m_colorBar.Location = new System.Drawing.Point(422, 8); + this.m_colorBar.Name = "m_colorBar"; + this.m_colorBar.NumberOfColors = Sunny.UI.ColorSlider.eNumberOfColors.Use3Colors; + this.m_colorBar.Orientation = System.Windows.Forms.Orientation.Vertical; + this.m_colorBar.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); + this.m_colorBar.Percent = 0F; + this.m_colorBar.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleRight; + this.m_colorBar.Size = new System.Drawing.Size(45, 148); + this.m_colorBar.Style = Sunny.UI.UIStyle.Custom; + this.m_colorBar.StyleCustomMode = false; + this.m_colorBar.TabIndex = 11; + this.m_colorBar.TagString = null; + this.m_colorBar.Text = "Lightness"; + this.m_colorBar.TextAlign = System.Drawing.ContentAlignment.BottomCenter; + this.m_colorBar.TextAngle = 270F; + this.m_colorBar.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MaxToMin; + this.m_colorBar.SelectedValueChanged += new System.EventHandler(this.m_colorBar_SelectedValueChanged); + // + // m_opacitySlider + // + this.m_opacitySlider.BackColor = System.Drawing.Color.Transparent; + this.m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25); + this.m_opacitySlider.Color1 = System.Drawing.Color.White; + this.m_opacitySlider.Color2 = System.Drawing.Color.Black; + this.m_opacitySlider.Color3 = System.Drawing.Color.Black; + this.m_opacitySlider.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.m_opacitySlider.ForeColor = System.Drawing.Color.Black; + this.m_opacitySlider.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.m_opacitySlider.Location = new System.Drawing.Point(269, 163); + this.m_opacitySlider.Name = "m_opacitySlider"; + this.m_opacitySlider.NumberOfColors = Sunny.UI.ColorSlider.eNumberOfColors.Use2Colors; + this.m_opacitySlider.Orientation = System.Windows.Forms.Orientation.Horizontal; + this.m_opacitySlider.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); + this.m_opacitySlider.Percent = 1F; + this.m_opacitySlider.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter; + this.m_opacitySlider.Size = new System.Drawing.Size(198, 26); + this.m_opacitySlider.Style = Sunny.UI.UIStyle.Custom; + this.m_opacitySlider.StyleCustomMode = false; + this.m_opacitySlider.TabIndex = 1; + this.m_opacitySlider.TagString = null; + this.m_opacitySlider.Text = "Opacity"; + this.m_opacitySlider.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_opacitySlider.TextAngle = 0F; + this.m_opacitySlider.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MinToMax; + this.m_opacitySlider.SelectedValueChanged += new System.EventHandler(this.m_opacitySlider_SelectedValueChanged); + // + // btnOK + // + this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F); + this.btnOK.Location = new System.Drawing.Point(269, 197); + this.btnOK.Name = "btnOK"; + this.btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); + this.btnOK.Size = new System.Drawing.Size(95, 26); + this.btnOK.Style = Sunny.UI.UIStyle.Custom; + this.btnOK.TabIndex = 12; + this.btnOK.Text = "确定"; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // btnCancel + // + this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F); + this.btnCancel.Location = new System.Drawing.Point(372, 197); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); + this.btnCancel.Size = new System.Drawing.Size(95, 26); + this.btnCancel.Style = Sunny.UI.UIStyle.Custom; + this.btnCancel.Symbol = 61453; + this.btnCancel.TabIndex = 13; + this.btnCancel.Text = "取消"; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // UIColorItem + // + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.m_opacitySlider); + this.Controls.Add(this.m_colorBar); + this.Controls.Add(this.m_colorWheel); + this.Controls.Add(this.lblB); + this.Controls.Add(this.lblG); + this.Controls.Add(this.lblR); + this.Controls.Add(this.lblA); + this.Controls.Add(this.edtB); + this.Controls.Add(this.edtG); + this.Controls.Add(this.edtR); + this.Controls.Add(this.edtA); + this.Controls.Add(this.m_colorSample); + this.Controls.Add(this.m_colorTable); + this.FillColor = System.Drawing.Color.White; + this.Name = "UIColorItem"; + this.Size = new System.Drawing.Size(476, 233); + this.Style = Sunny.UI.UIStyle.Custom; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e) + { + Color selcol = (Color)m_colorTable.SelectedItem; + if (selcol != m_selectedColor) + { + lockColorTable = true; + m_colorWheel.SelectedColor = selcol; + lockColorTable = false; + m_colorSample.Invalidate(); + } + } + + private Color m_selectedColor = Color.AntiqueWhite; + + private float m_opacity = 1; + + private bool lockColorTable = false; + + public Color SelectedColor + { + get { return Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor); } + set + { + m_opacity = (float)value.A / 255f; + value = Color.FromArgb(255, value); + m_colorWheel.SelectedColor = value; + if (m_colorTable.ColorExist(value) == false) + m_colorTable.SetCustomColor(value); + m_colorTable.SelectedItem = value; + m_opacitySlider.Percent = m_opacity; + } + } + + private void m_colorBar_SelectedValueChanged(object sender, EventArgs e) + { + m_colorWheel.SetLightness(m_colorBar.SelectedHSLColor.Lightness); + } + + private void m_opacitySlider_SelectedValueChanged(object sender, EventArgs e) + { + m_opacity = Math.Max(0, m_opacitySlider.Percent); + m_opacity = Math.Min(1, m_opacitySlider.Percent); + m_colorSample.Refresh(); + 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) + { + Color selcol = m_colorWheel.SelectedColor; + if (selcol != m_selectedColor) + { + m_selectedColor = selcol; + m_colorSample.Refresh(); + if (lockColorTable == false && selcol != m_colorTable.SelectedItem) + m_colorTable.SetCustomColor(selcol); + } + + m_colorBar.SelectedHSLColor = m_colorWheel.SelectedHSLColor; + UpdateInfo(); + } + + private void btnCancel_Click(object sender, EventArgs e) + { + CloseParent(); + } + + private void btnOK_Click(object sender, EventArgs e) + { + DoValueChanged(this, SelectedColor); + CloseParent(); + } + + private void m_colorSample_Paint(object sender, System.Windows.Forms.PaintEventArgs e) + { + Rectangle r = m_colorSample.ClientRectangle; + r.Inflate(-4, -4); + + int width = r.Width; + r.Width /= 2; + + Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor); + SolidBrush b = new SolidBrush(c); + e.Graphics.FillRectangle(b, r); + + r.X += r.Width; + + e.Graphics.FillRectangle(Brushes.White, r); + c = Color.FromArgb(255, m_selectedColor); + b = new SolidBrush(c); + e.Graphics.FillRectangle(b, r); + } + + public override void SetStyle(UIBaseStyle uiColor) + { + base.SetStyleColor(uiColor); + RectColor = uiColor.RectColor; + BackColor = uiColor.PlainColor; + btnOK.SetStyleColor(uiColor); + btnCancel.SetStyleColor(uiColor); + m_colorTable.SetStyleColor(uiColor); + m_colorWheel.SetStyleColor(uiColor); + m_colorBar.SetStyleColor(uiColor); + m_colorSample.SetStyleColor(uiColor); + m_opacitySlider.SetStyleColor(uiColor); + edtA.SetStyleColor(uiColor); + edtR.SetStyleColor(uiColor); + edtG.SetStyleColor(uiColor); + edtB.SetStyleColor(uiColor); + lblA.ForeColor = lblR.ForeColor = lblG.ForeColor = lblB.ForeColor = uiColor.PanelForeColor; + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIColorItem.resx b/SunnyUI/Controls/DropItem/UIColorItem.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SunnyUI/Controls/DropItem/UIColorItem.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIDateItem.cs b/SunnyUI/Controls/DropItem/UIDateItem.cs new file mode 100644 index 00000000..91ad8537 --- /dev/null +++ b/SunnyUI/Controls/DropItem/UIDateItem.cs @@ -0,0 +1,1694 @@ +/****************************************************************************** + * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。 + * CopyRight (C) 2012-2020 ShenYongHua(沈永华). + * QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com + * + * Blog: https://www.cnblogs.com/yhuse + * Gitee: https://gitee.com/yhuse/SunnyUI + * GitHub: https://github.com/yhuse/SunnyUI + * + * SunnyUI.dll can be used for free under the GPL-3.0 license. + * If you use this code, please keep this note. + * 如果您使用此代码,请保留此说明。 + ****************************************************************************** + * 文件名称: UIDateItem.cs + * 文件说明: 日期选择框弹出窗体 + * 当前版本: V2.2 + * 创建日期: 2020-01-01 + * + * 2020-01-01: V2.2.0 增加文件说明 + * 2020-05-29: V2.2.5 重写 +******************************************************************************/ + +using System; +using System.Drawing; + +namespace Sunny.UI +{ + public sealed class UIDateItem : UIDropDownItem + { + private UITabControl TabControl; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private UIPanel p1; + private UISymbolButton b4; + private UISymbolButton b3; + private UISymbolButton b2; + private UISymbolButton b1; + private UIPanel p2; + private System.Windows.Forms.TabPage tabPage3; + private UIPanel p3; + private UILabel m12; + private UILabel m11; + private UILabel m10; + private UILabel m9; + private UILabel m8; + private UILabel m7; + private UILabel m6; + private UILabel m5; + private UILabel m4; + private UILabel m3; + private UILabel m2; + private UILabel m1; + private UILabel d36; + private UILabel d29; + private UILabel d22; + private UILabel d15; + private UILabel d8; + private UILabel d1; + private UILabel uiLabel1; + private UILine uiLine1; + private UILabel d42; + private UILabel d35; + private UILabel d28; + private UILabel d21; + private UILabel d14; + private UILabel d7; + private UILabel d41; + private UILabel d34; + private UILabel d27; + private UILabel d20; + private UILabel d13; + private UILabel d6; + private UILabel d40; + private UILabel d33; + private UILabel d26; + private UILabel d19; + private UILabel d12; + private UILabel d5; + private UILabel d39; + private UILabel d32; + private UILabel d25; + private UILabel d18; + private UILabel d11; + private UILabel d4; + private UILabel d38; + private UILabel d31; + private UILabel d24; + private UILabel d17; + private UILabel d10; + private UILabel d3; + private UILabel d37; + private UILabel d30; + private UILabel d23; + private UILabel d16; + private UILabel d9; + private UILabel d2; + private UILabel uiLabel13; + private UILabel uiLabel12; + private UILabel uiLabel11; + private UILabel uiLabel10; + private UILabel uiLabel9; + private UILabel uiLabel7; + private UILabel y10; + private UILabel y9; + private UILabel y8; + private UILabel y7; + private UILabel y6; + private UILabel y5; + private UILabel y4; + private UILabel y3; + private UILabel y2; + private UILabel y1; + private UIPanel TopPanel; + + private void InitializeComponent() + { + this.TopPanel = new Sunny.UI.UIPanel(); + this.b4 = new Sunny.UI.UISymbolButton(); + this.b3 = new Sunny.UI.UISymbolButton(); + this.b2 = new Sunny.UI.UISymbolButton(); + this.b1 = new Sunny.UI.UISymbolButton(); + this.TabControl = new Sunny.UI.UITabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.p1 = new Sunny.UI.UIPanel(); + this.y10 = new Sunny.UI.UILabel(); + this.y9 = new Sunny.UI.UILabel(); + this.y8 = new Sunny.UI.UILabel(); + this.y7 = new Sunny.UI.UILabel(); + this.y6 = new Sunny.UI.UILabel(); + this.y5 = new Sunny.UI.UILabel(); + this.y4 = new Sunny.UI.UILabel(); + this.y3 = new Sunny.UI.UILabel(); + this.y2 = new Sunny.UI.UILabel(); + this.y1 = new Sunny.UI.UILabel(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.p2 = new Sunny.UI.UIPanel(); + this.m12 = new Sunny.UI.UILabel(); + this.m11 = new Sunny.UI.UILabel(); + this.m10 = new Sunny.UI.UILabel(); + this.m9 = new Sunny.UI.UILabel(); + this.m8 = new Sunny.UI.UILabel(); + this.m7 = new Sunny.UI.UILabel(); + this.m6 = new Sunny.UI.UILabel(); + this.m5 = new Sunny.UI.UILabel(); + this.m4 = new Sunny.UI.UILabel(); + this.m3 = new Sunny.UI.UILabel(); + this.m2 = new Sunny.UI.UILabel(); + this.m1 = new Sunny.UI.UILabel(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.p3 = new Sunny.UI.UIPanel(); + this.d42 = new Sunny.UI.UILabel(); + this.d35 = new Sunny.UI.UILabel(); + this.d28 = new Sunny.UI.UILabel(); + this.d21 = new Sunny.UI.UILabel(); + this.d14 = new Sunny.UI.UILabel(); + this.d7 = new Sunny.UI.UILabel(); + this.d41 = new Sunny.UI.UILabel(); + this.d34 = new Sunny.UI.UILabel(); + this.d27 = new Sunny.UI.UILabel(); + this.d20 = new Sunny.UI.UILabel(); + this.d13 = new Sunny.UI.UILabel(); + this.d6 = new Sunny.UI.UILabel(); + this.d40 = new Sunny.UI.UILabel(); + this.d33 = new Sunny.UI.UILabel(); + this.d26 = new Sunny.UI.UILabel(); + this.d19 = new Sunny.UI.UILabel(); + this.d12 = new Sunny.UI.UILabel(); + this.d5 = new Sunny.UI.UILabel(); + this.d39 = new Sunny.UI.UILabel(); + this.d32 = new Sunny.UI.UILabel(); + this.d25 = new Sunny.UI.UILabel(); + this.d18 = new Sunny.UI.UILabel(); + this.d11 = new Sunny.UI.UILabel(); + this.d4 = new Sunny.UI.UILabel(); + this.d38 = new Sunny.UI.UILabel(); + this.d31 = new Sunny.UI.UILabel(); + this.d24 = new Sunny.UI.UILabel(); + this.d17 = new Sunny.UI.UILabel(); + this.d10 = new Sunny.UI.UILabel(); + this.d3 = new Sunny.UI.UILabel(); + this.d37 = new Sunny.UI.UILabel(); + this.d30 = new Sunny.UI.UILabel(); + this.d23 = new Sunny.UI.UILabel(); + this.d16 = new Sunny.UI.UILabel(); + this.d9 = new Sunny.UI.UILabel(); + this.d2 = new Sunny.UI.UILabel(); + this.uiLabel13 = new Sunny.UI.UILabel(); + this.uiLabel12 = new Sunny.UI.UILabel(); + this.uiLabel11 = new Sunny.UI.UILabel(); + this.uiLabel10 = new Sunny.UI.UILabel(); + this.uiLabel9 = new Sunny.UI.UILabel(); + this.uiLabel7 = new Sunny.UI.UILabel(); + this.d36 = new Sunny.UI.UILabel(); + this.d29 = new Sunny.UI.UILabel(); + this.d22 = new Sunny.UI.UILabel(); + this.d15 = new Sunny.UI.UILabel(); + this.d8 = new Sunny.UI.UILabel(); + this.d1 = new Sunny.UI.UILabel(); + this.uiLabel1 = new Sunny.UI.UILabel(); + this.uiLine1 = new Sunny.UI.UILine(); + this.TopPanel.SuspendLayout(); + this.TabControl.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.p1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.p2.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.p3.SuspendLayout(); + this.SuspendLayout(); + // + // TopPanel + // + this.TopPanel.Controls.Add(this.b4); + this.TopPanel.Controls.Add(this.b3); + this.TopPanel.Controls.Add(this.b2); + this.TopPanel.Controls.Add(this.b1); + this.TopPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.TopPanel.FillColor = System.Drawing.Color.White; + this.TopPanel.Font = new System.Drawing.Font("微软雅黑", 12F); + this.TopPanel.Location = new System.Drawing.Point(0, 0); + this.TopPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.TopPanel.Name = "TopPanel"; + this.TopPanel.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.TopPanel.RectSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)(((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) + | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right))); + this.TopPanel.Size = new System.Drawing.Size(461, 31); + this.TopPanel.Style = Sunny.UI.UIStyle.Custom; + this.TopPanel.StyleCustomMode = true; + this.TopPanel.TabIndex = 0; + this.TopPanel.Text = "2020-05-05"; + this.TopPanel.Click += new System.EventHandler(this.TopPanel_Click); + // + // b4 + // + this.b4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.b4.BackColor = System.Drawing.Color.Transparent; + this.b4.Cursor = System.Windows.Forms.Cursors.Hand; + this.b4.FillColor = System.Drawing.Color.White; + this.b4.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.b4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b4.ImageInterval = 0; + this.b4.Location = new System.Drawing.Point(427, 4); + this.b4.Name = "b4"; + this.b4.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0); + this.b4.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.b4.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b4.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; + this.b4.Size = new System.Drawing.Size(30, 24); + this.b4.Style = Sunny.UI.UIStyle.Custom; + this.b4.StyleCustomMode = true; + this.b4.Symbol = 61697; + this.b4.TabIndex = 3; + this.b4.Click += new System.EventHandler(this.b4_Click); + // + // b3 + // + this.b3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.b3.BackColor = System.Drawing.Color.Transparent; + this.b3.Cursor = System.Windows.Forms.Cursors.Hand; + this.b3.FillColor = System.Drawing.Color.White; + this.b3.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.b3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b3.ImageInterval = 0; + this.b3.Location = new System.Drawing.Point(391, 4); + this.b3.Name = "b3"; + this.b3.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0); + this.b3.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.b3.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b3.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; + this.b3.Size = new System.Drawing.Size(30, 24); + this.b3.Style = Sunny.UI.UIStyle.Custom; + this.b3.StyleCustomMode = true; + this.b3.Symbol = 61701; + this.b3.TabIndex = 2; + this.b3.Click += new System.EventHandler(this.b3_Click); + // + // b2 + // + this.b2.BackColor = System.Drawing.Color.Transparent; + this.b2.Cursor = System.Windows.Forms.Cursors.Hand; + this.b2.FillColor = System.Drawing.Color.White; + this.b2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.b2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b2.ImageInterval = 0; + this.b2.Location = new System.Drawing.Point(40, 4); + this.b2.Name = "b2"; + this.b2.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0); + this.b2.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.b2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b2.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; + this.b2.Size = new System.Drawing.Size(30, 24); + this.b2.Style = Sunny.UI.UIStyle.Custom; + this.b2.StyleCustomMode = true; + this.b2.Symbol = 61700; + this.b2.TabIndex = 1; + this.b2.Click += new System.EventHandler(this.b2_Click); + // + // b1 + // + this.b1.BackColor = System.Drawing.Color.Transparent; + this.b1.Cursor = System.Windows.Forms.Cursors.Hand; + this.b1.FillColor = System.Drawing.Color.White; + this.b1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.b1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b1.ImageInterval = 0; + this.b1.Location = new System.Drawing.Point(4, 4); + this.b1.Name = "b1"; + this.b1.Padding = new System.Windows.Forms.Padding(24, 0, 0, 0); + this.b1.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.b1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); + this.b1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; + this.b1.Size = new System.Drawing.Size(30, 24); + this.b1.Style = Sunny.UI.UIStyle.Custom; + this.b1.StyleCustomMode = true; + this.b1.Symbol = 61696; + this.b1.TabIndex = 0; + this.b1.Click += new System.EventHandler(this.b1_Click); + // + // TabControl + // + this.TabControl.Controls.Add(this.tabPage1); + this.TabControl.Controls.Add(this.tabPage2); + this.TabControl.Controls.Add(this.tabPage3); + this.TabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.TabControl.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed; + this.TabControl.Font = new System.Drawing.Font("微软雅黑", 12F); + this.TabControl.ItemSize = new System.Drawing.Size(150, 40); + this.TabControl.Location = new System.Drawing.Point(0, 31); + this.TabControl.Name = "TabControl"; + this.TabControl.SelectedIndex = 0; + this.TabControl.Size = new System.Drawing.Size(461, 317); + this.TabControl.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; + this.TabControl.Style = Sunny.UI.UIStyle.Custom; + this.TabControl.TabIndex = 1; + this.TabControl.SelectedIndexChanged += new System.EventHandler(this.TabControl_SelectedIndexChanged); + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.p1); + this.tabPage1.Location = new System.Drawing.Point(0, 40); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Size = new System.Drawing.Size(461, 277); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "tabPage1"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // p1 + // + this.p1.Controls.Add(this.y10); + this.p1.Controls.Add(this.y9); + this.p1.Controls.Add(this.y8); + this.p1.Controls.Add(this.y7); + this.p1.Controls.Add(this.y6); + this.p1.Controls.Add(this.y5); + this.p1.Controls.Add(this.y4); + this.p1.Controls.Add(this.y3); + this.p1.Controls.Add(this.y2); + this.p1.Controls.Add(this.y1); + this.p1.Dock = System.Windows.Forms.DockStyle.Fill; + this.p1.FillColor = System.Drawing.Color.White; + this.p1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.p1.Location = new System.Drawing.Point(0, 0); + this.p1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.p1.Name = "p1"; + this.p1.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.p1.Size = new System.Drawing.Size(461, 277); + this.p1.Style = Sunny.UI.UIStyle.Custom; + this.p1.TabIndex = 0; + this.p1.Text = null; + // + // y10 + // + this.y10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y10.Location = new System.Drawing.Point(83, 112); + this.y10.Name = "y10"; + this.y10.Size = new System.Drawing.Size(70, 51); + this.y10.Style = Sunny.UI.UIStyle.Custom; + this.y10.StyleCustomMode = true; + this.y10.TabIndex = 33; + this.y10.Tag = "10"; + this.y10.Text = "十月"; + this.y10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y10.Click += new System.EventHandler(this.y1_Click); + // + // y9 + // + this.y9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y9.Location = new System.Drawing.Point(7, 112); + this.y9.Name = "y9"; + this.y9.Size = new System.Drawing.Size(70, 51); + this.y9.Style = Sunny.UI.UIStyle.Custom; + this.y9.StyleCustomMode = true; + this.y9.TabIndex = 32; + this.y9.Tag = "9"; + this.y9.Text = "九月"; + this.y9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y9.Click += new System.EventHandler(this.y1_Click); + // + // y8 + // + this.y8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y8.Location = new System.Drawing.Point(235, 58); + this.y8.Name = "y8"; + this.y8.Size = new System.Drawing.Size(70, 51); + this.y8.Style = Sunny.UI.UIStyle.Custom; + this.y8.StyleCustomMode = true; + this.y8.TabIndex = 31; + this.y8.Tag = "8"; + this.y8.Text = "八月"; + this.y8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y8.Click += new System.EventHandler(this.y1_Click); + // + // y7 + // + this.y7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y7.Location = new System.Drawing.Point(159, 58); + this.y7.Name = "y7"; + this.y7.Size = new System.Drawing.Size(70, 51); + this.y7.Style = Sunny.UI.UIStyle.Custom; + this.y7.StyleCustomMode = true; + this.y7.TabIndex = 30; + this.y7.Tag = "7"; + this.y7.Text = "七月"; + this.y7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y7.Click += new System.EventHandler(this.y1_Click); + // + // y6 + // + this.y6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y6.Location = new System.Drawing.Point(83, 58); + this.y6.Name = "y6"; + this.y6.Size = new System.Drawing.Size(70, 51); + this.y6.Style = Sunny.UI.UIStyle.Custom; + this.y6.StyleCustomMode = true; + this.y6.TabIndex = 29; + this.y6.Tag = "6"; + this.y6.Text = "六月"; + this.y6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y6.Click += new System.EventHandler(this.y1_Click); + // + // y5 + // + this.y5.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y5.Location = new System.Drawing.Point(7, 58); + this.y5.Name = "y5"; + this.y5.Size = new System.Drawing.Size(70, 51); + this.y5.Style = Sunny.UI.UIStyle.Custom; + this.y5.StyleCustomMode = true; + this.y5.TabIndex = 28; + this.y5.Tag = "5"; + this.y5.Text = "五月"; + this.y5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y5.Click += new System.EventHandler(this.y1_Click); + // + // y4 + // + this.y4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y4.Location = new System.Drawing.Point(235, 4); + this.y4.Name = "y4"; + this.y4.Size = new System.Drawing.Size(70, 51); + this.y4.Style = Sunny.UI.UIStyle.Custom; + this.y4.StyleCustomMode = true; + this.y4.TabIndex = 27; + this.y4.Tag = "4"; + this.y4.Text = "四月"; + this.y4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y4.Click += new System.EventHandler(this.y1_Click); + // + // y3 + // + this.y3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y3.Location = new System.Drawing.Point(159, 4); + this.y3.Name = "y3"; + this.y3.Size = new System.Drawing.Size(70, 51); + this.y3.Style = Sunny.UI.UIStyle.Custom; + this.y3.StyleCustomMode = true; + this.y3.TabIndex = 26; + this.y3.Tag = "3"; + this.y3.Text = "三月"; + this.y3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y3.Click += new System.EventHandler(this.y1_Click); + // + // y2 + // + this.y2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y2.Location = new System.Drawing.Point(83, 4); + this.y2.Name = "y2"; + this.y2.Size = new System.Drawing.Size(70, 51); + this.y2.Style = Sunny.UI.UIStyle.Custom; + this.y2.StyleCustomMode = true; + this.y2.TabIndex = 25; + this.y2.Tag = "2"; + this.y2.Text = "二月"; + this.y2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y2.Click += new System.EventHandler(this.y1_Click); + // + // y1 + // + this.y1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.y1.Location = new System.Drawing.Point(7, 4); + this.y1.Name = "y1"; + this.y1.Size = new System.Drawing.Size(70, 51); + this.y1.Style = Sunny.UI.UIStyle.Custom; + this.y1.StyleCustomMode = true; + this.y1.TabIndex = 24; + this.y1.Tag = "1"; + this.y1.Text = "一月"; + this.y1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.y1.Click += new System.EventHandler(this.y1_Click); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.p2); + this.tabPage2.Location = new System.Drawing.Point(0, 40); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Size = new System.Drawing.Size(461, 277); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "tabPage2"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // p2 + // + this.p2.Controls.Add(this.m12); + this.p2.Controls.Add(this.m11); + this.p2.Controls.Add(this.m10); + this.p2.Controls.Add(this.m9); + this.p2.Controls.Add(this.m8); + this.p2.Controls.Add(this.m7); + this.p2.Controls.Add(this.m6); + this.p2.Controls.Add(this.m5); + this.p2.Controls.Add(this.m4); + this.p2.Controls.Add(this.m3); + this.p2.Controls.Add(this.m2); + this.p2.Controls.Add(this.m1); + this.p2.Dock = System.Windows.Forms.DockStyle.Fill; + this.p2.FillColor = System.Drawing.Color.White; + this.p2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.p2.Location = new System.Drawing.Point(0, 0); + this.p2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.p2.Name = "p2"; + this.p2.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.p2.Size = new System.Drawing.Size(461, 277); + this.p2.Style = Sunny.UI.UIStyle.Custom; + this.p2.TabIndex = 1; + this.p2.Text = null; + // + // m12 + // + this.m12.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m12.Location = new System.Drawing.Point(235, 112); + this.m12.Name = "m12"; + this.m12.Size = new System.Drawing.Size(70, 51); + this.m12.Style = Sunny.UI.UIStyle.Custom; + this.m12.StyleCustomMode = true; + this.m12.TabIndex = 23; + this.m12.Tag = "12"; + this.m12.Text = "十二月"; + this.m12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m12.Click += new System.EventHandler(this.m1_Click); + // + // m11 + // + this.m11.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m11.Location = new System.Drawing.Point(159, 112); + this.m11.Name = "m11"; + this.m11.Size = new System.Drawing.Size(70, 51); + this.m11.Style = Sunny.UI.UIStyle.Custom; + this.m11.StyleCustomMode = true; + this.m11.TabIndex = 22; + this.m11.Tag = "11"; + this.m11.Text = "十一月"; + this.m11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m11.Click += new System.EventHandler(this.m1_Click); + // + // m10 + // + this.m10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m10.Location = new System.Drawing.Point(83, 112); + this.m10.Name = "m10"; + this.m10.Size = new System.Drawing.Size(70, 51); + this.m10.Style = Sunny.UI.UIStyle.Custom; + this.m10.StyleCustomMode = true; + this.m10.TabIndex = 21; + this.m10.Tag = "10"; + this.m10.Text = "十月"; + this.m10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m10.Click += new System.EventHandler(this.m1_Click); + // + // m9 + // + this.m9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m9.Location = new System.Drawing.Point(7, 112); + this.m9.Name = "m9"; + this.m9.Size = new System.Drawing.Size(70, 51); + this.m9.Style = Sunny.UI.UIStyle.Custom; + this.m9.StyleCustomMode = true; + this.m9.TabIndex = 20; + this.m9.Tag = "9"; + this.m9.Text = "九月"; + this.m9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m9.Click += new System.EventHandler(this.m1_Click); + // + // m8 + // + this.m8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m8.Location = new System.Drawing.Point(235, 58); + this.m8.Name = "m8"; + this.m8.Size = new System.Drawing.Size(70, 51); + this.m8.Style = Sunny.UI.UIStyle.Custom; + this.m8.StyleCustomMode = true; + this.m8.TabIndex = 19; + this.m8.Tag = "8"; + this.m8.Text = "八月"; + this.m8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m8.Click += new System.EventHandler(this.m1_Click); + // + // m7 + // + this.m7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m7.Location = new System.Drawing.Point(159, 58); + this.m7.Name = "m7"; + this.m7.Size = new System.Drawing.Size(70, 51); + this.m7.Style = Sunny.UI.UIStyle.Custom; + this.m7.StyleCustomMode = true; + this.m7.TabIndex = 18; + this.m7.Tag = "7"; + this.m7.Text = "七月"; + this.m7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m7.Click += new System.EventHandler(this.m1_Click); + // + // m6 + // + this.m6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m6.Location = new System.Drawing.Point(83, 58); + this.m6.Name = "m6"; + this.m6.Size = new System.Drawing.Size(70, 51); + this.m6.Style = Sunny.UI.UIStyle.Custom; + this.m6.StyleCustomMode = true; + this.m6.TabIndex = 17; + this.m6.Tag = "6"; + this.m6.Text = "六月"; + this.m6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m6.Click += new System.EventHandler(this.m1_Click); + // + // m5 + // + this.m5.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m5.Location = new System.Drawing.Point(7, 58); + this.m5.Name = "m5"; + this.m5.Size = new System.Drawing.Size(70, 51); + this.m5.Style = Sunny.UI.UIStyle.Custom; + this.m5.StyleCustomMode = true; + this.m5.TabIndex = 16; + this.m5.Tag = "5"; + this.m5.Text = "五月"; + this.m5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m5.Click += new System.EventHandler(this.m1_Click); + // + // m4 + // + this.m4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m4.Location = new System.Drawing.Point(235, 4); + this.m4.Name = "m4"; + this.m4.Size = new System.Drawing.Size(70, 51); + this.m4.Style = Sunny.UI.UIStyle.Custom; + this.m4.StyleCustomMode = true; + this.m4.TabIndex = 15; + this.m4.Tag = "4"; + this.m4.Text = "四月"; + this.m4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m4.Click += new System.EventHandler(this.m1_Click); + // + // m3 + // + this.m3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m3.Location = new System.Drawing.Point(159, 4); + this.m3.Name = "m3"; + this.m3.Size = new System.Drawing.Size(70, 51); + this.m3.Style = Sunny.UI.UIStyle.Custom; + this.m3.StyleCustomMode = true; + this.m3.TabIndex = 14; + this.m3.Tag = "3"; + this.m3.Text = "三月"; + this.m3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m3.Click += new System.EventHandler(this.m1_Click); + // + // m2 + // + this.m2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m2.Location = new System.Drawing.Point(83, 4); + this.m2.Name = "m2"; + this.m2.Size = new System.Drawing.Size(70, 51); + this.m2.Style = Sunny.UI.UIStyle.Custom; + this.m2.StyleCustomMode = true; + this.m2.TabIndex = 13; + this.m2.Tag = "2"; + this.m2.Text = "二月"; + this.m2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m2.Click += new System.EventHandler(this.m1_Click); + // + // m1 + // + this.m1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.m1.Location = new System.Drawing.Point(7, 4); + this.m1.Name = "m1"; + this.m1.Size = new System.Drawing.Size(70, 51); + this.m1.Style = Sunny.UI.UIStyle.Custom; + this.m1.StyleCustomMode = true; + this.m1.TabIndex = 12; + this.m1.Tag = "1"; + this.m1.Text = "一月"; + this.m1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.m1.Click += new System.EventHandler(this.m1_Click); + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.p3); + this.tabPage3.Location = new System.Drawing.Point(0, 40); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(461, 277); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "tabPage3"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // p3 + // + this.p3.Controls.Add(this.d42); + this.p3.Controls.Add(this.d35); + this.p3.Controls.Add(this.d28); + this.p3.Controls.Add(this.d21); + this.p3.Controls.Add(this.d14); + this.p3.Controls.Add(this.d7); + this.p3.Controls.Add(this.d41); + this.p3.Controls.Add(this.d34); + this.p3.Controls.Add(this.d27); + this.p3.Controls.Add(this.d20); + this.p3.Controls.Add(this.d13); + this.p3.Controls.Add(this.d6); + this.p3.Controls.Add(this.d40); + this.p3.Controls.Add(this.d33); + this.p3.Controls.Add(this.d26); + this.p3.Controls.Add(this.d19); + this.p3.Controls.Add(this.d12); + this.p3.Controls.Add(this.d5); + this.p3.Controls.Add(this.d39); + this.p3.Controls.Add(this.d32); + this.p3.Controls.Add(this.d25); + this.p3.Controls.Add(this.d18); + this.p3.Controls.Add(this.d11); + this.p3.Controls.Add(this.d4); + this.p3.Controls.Add(this.d38); + this.p3.Controls.Add(this.d31); + this.p3.Controls.Add(this.d24); + this.p3.Controls.Add(this.d17); + this.p3.Controls.Add(this.d10); + this.p3.Controls.Add(this.d3); + this.p3.Controls.Add(this.d37); + this.p3.Controls.Add(this.d30); + this.p3.Controls.Add(this.d23); + this.p3.Controls.Add(this.d16); + this.p3.Controls.Add(this.d9); + this.p3.Controls.Add(this.d2); + this.p3.Controls.Add(this.uiLabel13); + this.p3.Controls.Add(this.uiLabel12); + this.p3.Controls.Add(this.uiLabel11); + this.p3.Controls.Add(this.uiLabel10); + this.p3.Controls.Add(this.uiLabel9); + this.p3.Controls.Add(this.uiLabel7); + this.p3.Controls.Add(this.d36); + this.p3.Controls.Add(this.d29); + this.p3.Controls.Add(this.d22); + this.p3.Controls.Add(this.d15); + this.p3.Controls.Add(this.d8); + this.p3.Controls.Add(this.d1); + this.p3.Controls.Add(this.uiLabel1); + this.p3.Controls.Add(this.uiLine1); + this.p3.Dock = System.Windows.Forms.DockStyle.Fill; + this.p3.FillColor = System.Drawing.Color.White; + this.p3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.p3.Location = new System.Drawing.Point(0, 0); + this.p3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.p3.Name = "p3"; + this.p3.RadiusSides = Sunny.UI.UICornerRadiusSides.None; + this.p3.Size = new System.Drawing.Size(461, 277); + this.p3.Style = Sunny.UI.UIStyle.Custom; + this.p3.TabIndex = 2; + this.p3.Text = null; + // + // d42 + // + this.d42.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d42.Location = new System.Drawing.Point(268, 145); + this.d42.Name = "d42"; + this.d42.Size = new System.Drawing.Size(40, 19); + this.d42.Style = Sunny.UI.UIStyle.Custom; + this.d42.StyleCustomMode = true; + this.d42.TabIndex = 49; + this.d42.Text = "uiLabel44"; + this.d42.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d42.Click += new System.EventHandler(this.d1_Click); + // + // d35 + // + this.d35.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d35.Location = new System.Drawing.Point(268, 122); + this.d35.Name = "d35"; + this.d35.Size = new System.Drawing.Size(40, 19); + this.d35.Style = Sunny.UI.UIStyle.Custom; + this.d35.StyleCustomMode = true; + this.d35.TabIndex = 48; + this.d35.Text = "uiLabel45"; + this.d35.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d35.Click += new System.EventHandler(this.d1_Click); + // + // d28 + // + this.d28.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d28.Location = new System.Drawing.Point(268, 99); + this.d28.Name = "d28"; + this.d28.Size = new System.Drawing.Size(40, 19); + this.d28.Style = Sunny.UI.UIStyle.Custom; + this.d28.StyleCustomMode = true; + this.d28.TabIndex = 47; + this.d28.Text = "uiLabel46"; + this.d28.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d28.Click += new System.EventHandler(this.d1_Click); + // + // d21 + // + this.d21.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d21.Location = new System.Drawing.Point(268, 76); + this.d21.Name = "d21"; + this.d21.Size = new System.Drawing.Size(40, 19); + this.d21.Style = Sunny.UI.UIStyle.Custom; + this.d21.StyleCustomMode = true; + this.d21.TabIndex = 46; + this.d21.Text = "uiLabel47"; + this.d21.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d21.Click += new System.EventHandler(this.d1_Click); + // + // d14 + // + this.d14.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d14.Location = new System.Drawing.Point(268, 53); + this.d14.Name = "d14"; + this.d14.Size = new System.Drawing.Size(40, 19); + this.d14.Style = Sunny.UI.UIStyle.Custom; + this.d14.StyleCustomMode = true; + this.d14.TabIndex = 45; + this.d14.Text = "uiLabel48"; + this.d14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d14.Click += new System.EventHandler(this.d1_Click); + // + // d7 + // + this.d7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d7.Location = new System.Drawing.Point(268, 30); + this.d7.Name = "d7"; + this.d7.Size = new System.Drawing.Size(40, 19); + this.d7.Style = Sunny.UI.UIStyle.Custom; + this.d7.StyleCustomMode = true; + this.d7.TabIndex = 44; + this.d7.Text = "uiLabel49"; + this.d7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d7.Click += new System.EventHandler(this.d1_Click); + // + // d41 + // + this.d41.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d41.Location = new System.Drawing.Point(224, 145); + this.d41.Name = "d41"; + this.d41.Size = new System.Drawing.Size(40, 19); + this.d41.Style = Sunny.UI.UIStyle.Custom; + this.d41.StyleCustomMode = true; + this.d41.TabIndex = 43; + this.d41.Text = "uiLabel38"; + this.d41.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d41.Click += new System.EventHandler(this.d1_Click); + // + // d34 + // + this.d34.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d34.Location = new System.Drawing.Point(224, 122); + this.d34.Name = "d34"; + this.d34.Size = new System.Drawing.Size(40, 19); + this.d34.Style = Sunny.UI.UIStyle.Custom; + this.d34.StyleCustomMode = true; + this.d34.TabIndex = 42; + this.d34.Text = "uiLabel39"; + this.d34.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d34.Click += new System.EventHandler(this.d1_Click); + // + // d27 + // + this.d27.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d27.Location = new System.Drawing.Point(224, 99); + this.d27.Name = "d27"; + this.d27.Size = new System.Drawing.Size(40, 19); + this.d27.Style = Sunny.UI.UIStyle.Custom; + this.d27.StyleCustomMode = true; + this.d27.TabIndex = 41; + this.d27.Text = "uiLabel40"; + this.d27.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d27.Click += new System.EventHandler(this.d1_Click); + // + // d20 + // + this.d20.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d20.Location = new System.Drawing.Point(224, 76); + this.d20.Name = "d20"; + this.d20.Size = new System.Drawing.Size(40, 19); + this.d20.Style = Sunny.UI.UIStyle.Custom; + this.d20.StyleCustomMode = true; + this.d20.TabIndex = 40; + this.d20.Text = "uiLabel41"; + this.d20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d20.Click += new System.EventHandler(this.d1_Click); + // + // d13 + // + this.d13.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d13.Location = new System.Drawing.Point(224, 53); + this.d13.Name = "d13"; + this.d13.Size = new System.Drawing.Size(40, 19); + this.d13.Style = Sunny.UI.UIStyle.Custom; + this.d13.StyleCustomMode = true; + this.d13.TabIndex = 39; + this.d13.Text = "uiLabel42"; + this.d13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d13.Click += new System.EventHandler(this.d1_Click); + // + // d6 + // + this.d6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d6.Location = new System.Drawing.Point(224, 30); + this.d6.Name = "d6"; + this.d6.Size = new System.Drawing.Size(40, 19); + this.d6.Style = Sunny.UI.UIStyle.Custom; + this.d6.StyleCustomMode = true; + this.d6.TabIndex = 38; + this.d6.Text = "uiLabel43"; + this.d6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d6.Click += new System.EventHandler(this.d1_Click); + // + // d40 + // + this.d40.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d40.Location = new System.Drawing.Point(180, 145); + this.d40.Name = "d40"; + this.d40.Size = new System.Drawing.Size(40, 19); + this.d40.Style = Sunny.UI.UIStyle.Custom; + this.d40.StyleCustomMode = true; + this.d40.TabIndex = 37; + this.d40.Text = "uiLabel32"; + this.d40.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d40.Click += new System.EventHandler(this.d1_Click); + // + // d33 + // + this.d33.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d33.Location = new System.Drawing.Point(180, 122); + this.d33.Name = "d33"; + this.d33.Size = new System.Drawing.Size(40, 19); + this.d33.Style = Sunny.UI.UIStyle.Custom; + this.d33.StyleCustomMode = true; + this.d33.TabIndex = 36; + this.d33.Text = "uiLabel33"; + this.d33.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d33.Click += new System.EventHandler(this.d1_Click); + // + // d26 + // + this.d26.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d26.Location = new System.Drawing.Point(180, 99); + this.d26.Name = "d26"; + this.d26.Size = new System.Drawing.Size(40, 19); + this.d26.Style = Sunny.UI.UIStyle.Custom; + this.d26.StyleCustomMode = true; + this.d26.TabIndex = 35; + this.d26.Text = "uiLabel34"; + this.d26.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d26.Click += new System.EventHandler(this.d1_Click); + // + // d19 + // + this.d19.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d19.Location = new System.Drawing.Point(180, 76); + this.d19.Name = "d19"; + this.d19.Size = new System.Drawing.Size(40, 19); + this.d19.Style = Sunny.UI.UIStyle.Custom; + this.d19.StyleCustomMode = true; + this.d19.TabIndex = 34; + this.d19.Text = "uiLabel35"; + this.d19.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d19.Click += new System.EventHandler(this.d1_Click); + // + // d12 + // + this.d12.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d12.Location = new System.Drawing.Point(180, 53); + this.d12.Name = "d12"; + this.d12.Size = new System.Drawing.Size(40, 19); + this.d12.Style = Sunny.UI.UIStyle.Custom; + this.d12.StyleCustomMode = true; + this.d12.TabIndex = 33; + this.d12.Text = "uiLabel36"; + this.d12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d12.Click += new System.EventHandler(this.d1_Click); + // + // d5 + // + this.d5.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d5.Location = new System.Drawing.Point(180, 30); + this.d5.Name = "d5"; + this.d5.Size = new System.Drawing.Size(40, 19); + this.d5.Style = Sunny.UI.UIStyle.Custom; + this.d5.StyleCustomMode = true; + this.d5.TabIndex = 32; + this.d5.Text = "uiLabel37"; + this.d5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d5.Click += new System.EventHandler(this.d1_Click); + // + // d39 + // + this.d39.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d39.Location = new System.Drawing.Point(136, 145); + this.d39.Name = "d39"; + this.d39.Size = new System.Drawing.Size(40, 19); + this.d39.Style = Sunny.UI.UIStyle.Custom; + this.d39.StyleCustomMode = true; + this.d39.TabIndex = 31; + this.d39.Text = "uiLabel26"; + this.d39.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d39.Click += new System.EventHandler(this.d1_Click); + // + // d32 + // + this.d32.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d32.Location = new System.Drawing.Point(136, 122); + this.d32.Name = "d32"; + this.d32.Size = new System.Drawing.Size(40, 19); + this.d32.Style = Sunny.UI.UIStyle.Custom; + this.d32.StyleCustomMode = true; + this.d32.TabIndex = 30; + this.d32.Text = "uiLabel27"; + this.d32.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d32.Click += new System.EventHandler(this.d1_Click); + // + // d25 + // + this.d25.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d25.Location = new System.Drawing.Point(136, 99); + this.d25.Name = "d25"; + this.d25.Size = new System.Drawing.Size(40, 19); + this.d25.Style = Sunny.UI.UIStyle.Custom; + this.d25.StyleCustomMode = true; + this.d25.TabIndex = 29; + this.d25.Text = "uiLabel28"; + this.d25.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d25.Click += new System.EventHandler(this.d1_Click); + // + // d18 + // + this.d18.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d18.Location = new System.Drawing.Point(136, 76); + this.d18.Name = "d18"; + this.d18.Size = new System.Drawing.Size(40, 19); + this.d18.Style = Sunny.UI.UIStyle.Custom; + this.d18.StyleCustomMode = true; + this.d18.TabIndex = 28; + this.d18.Text = "uiLabel29"; + this.d18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d18.Click += new System.EventHandler(this.d1_Click); + // + // d11 + // + this.d11.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d11.Location = new System.Drawing.Point(136, 53); + this.d11.Name = "d11"; + this.d11.Size = new System.Drawing.Size(40, 19); + this.d11.Style = Sunny.UI.UIStyle.Custom; + this.d11.StyleCustomMode = true; + this.d11.TabIndex = 27; + this.d11.Text = "uiLabel30"; + this.d11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d11.Click += new System.EventHandler(this.d1_Click); + // + // d4 + // + this.d4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d4.Location = new System.Drawing.Point(136, 30); + this.d4.Name = "d4"; + this.d4.Size = new System.Drawing.Size(40, 19); + this.d4.Style = Sunny.UI.UIStyle.Custom; + this.d4.StyleCustomMode = true; + this.d4.TabIndex = 26; + this.d4.Text = "uiLabel31"; + this.d4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d4.Click += new System.EventHandler(this.d1_Click); + // + // d38 + // + this.d38.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d38.Location = new System.Drawing.Point(92, 145); + this.d38.Name = "d38"; + this.d38.Size = new System.Drawing.Size(40, 19); + this.d38.Style = Sunny.UI.UIStyle.Custom; + this.d38.StyleCustomMode = true; + this.d38.TabIndex = 25; + this.d38.Text = "uiLabel20"; + this.d38.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d38.Click += new System.EventHandler(this.d1_Click); + // + // d31 + // + this.d31.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d31.Location = new System.Drawing.Point(92, 122); + this.d31.Name = "d31"; + this.d31.Size = new System.Drawing.Size(40, 19); + this.d31.Style = Sunny.UI.UIStyle.Custom; + this.d31.StyleCustomMode = true; + this.d31.TabIndex = 24; + this.d31.Text = "uiLabel21"; + this.d31.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d31.Click += new System.EventHandler(this.d1_Click); + // + // d24 + // + this.d24.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d24.Location = new System.Drawing.Point(92, 99); + this.d24.Name = "d24"; + this.d24.Size = new System.Drawing.Size(40, 19); + this.d24.Style = Sunny.UI.UIStyle.Custom; + this.d24.StyleCustomMode = true; + this.d24.TabIndex = 23; + this.d24.Text = "uiLabel22"; + this.d24.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d24.Click += new System.EventHandler(this.d1_Click); + // + // d17 + // + this.d17.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d17.Location = new System.Drawing.Point(92, 76); + this.d17.Name = "d17"; + this.d17.Size = new System.Drawing.Size(40, 19); + this.d17.Style = Sunny.UI.UIStyle.Custom; + this.d17.StyleCustomMode = true; + this.d17.TabIndex = 22; + this.d17.Text = "uiLabel23"; + this.d17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d17.Click += new System.EventHandler(this.d1_Click); + // + // d10 + // + this.d10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d10.Location = new System.Drawing.Point(92, 53); + this.d10.Name = "d10"; + this.d10.Size = new System.Drawing.Size(40, 19); + this.d10.Style = Sunny.UI.UIStyle.Custom; + this.d10.StyleCustomMode = true; + this.d10.TabIndex = 21; + this.d10.Text = "uiLabel24"; + this.d10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d10.Click += new System.EventHandler(this.d1_Click); + // + // d3 + // + this.d3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d3.Location = new System.Drawing.Point(92, 30); + this.d3.Name = "d3"; + this.d3.Size = new System.Drawing.Size(40, 19); + this.d3.Style = Sunny.UI.UIStyle.Custom; + this.d3.StyleCustomMode = true; + this.d3.TabIndex = 20; + this.d3.Text = "uiLabel25"; + this.d3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d3.Click += new System.EventHandler(this.d1_Click); + // + // d37 + // + this.d37.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d37.Location = new System.Drawing.Point(48, 145); + this.d37.Name = "d37"; + this.d37.Size = new System.Drawing.Size(40, 19); + this.d37.Style = Sunny.UI.UIStyle.Custom; + this.d37.StyleCustomMode = true; + this.d37.TabIndex = 19; + this.d37.Text = "uiLabel14"; + this.d37.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d37.Click += new System.EventHandler(this.d1_Click); + // + // d30 + // + this.d30.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d30.Location = new System.Drawing.Point(48, 122); + this.d30.Name = "d30"; + this.d30.Size = new System.Drawing.Size(40, 19); + this.d30.Style = Sunny.UI.UIStyle.Custom; + this.d30.StyleCustomMode = true; + this.d30.TabIndex = 18; + this.d30.Text = "uiLabel15"; + this.d30.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d30.Click += new System.EventHandler(this.d1_Click); + // + // d23 + // + this.d23.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d23.Location = new System.Drawing.Point(48, 99); + this.d23.Name = "d23"; + this.d23.Size = new System.Drawing.Size(40, 19); + this.d23.Style = Sunny.UI.UIStyle.Custom; + this.d23.StyleCustomMode = true; + this.d23.TabIndex = 17; + this.d23.Text = "uiLabel16"; + this.d23.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d23.Click += new System.EventHandler(this.d1_Click); + // + // d16 + // + this.d16.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d16.Location = new System.Drawing.Point(48, 76); + this.d16.Name = "d16"; + this.d16.Size = new System.Drawing.Size(40, 19); + this.d16.Style = Sunny.UI.UIStyle.Custom; + this.d16.StyleCustomMode = true; + this.d16.TabIndex = 16; + this.d16.Text = "uiLabel17"; + this.d16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d16.Click += new System.EventHandler(this.d1_Click); + // + // d9 + // + this.d9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d9.Location = new System.Drawing.Point(48, 53); + this.d9.Name = "d9"; + this.d9.Size = new System.Drawing.Size(40, 19); + this.d9.Style = Sunny.UI.UIStyle.Custom; + this.d9.StyleCustomMode = true; + this.d9.TabIndex = 15; + this.d9.Text = "uiLabel18"; + this.d9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d9.Click += new System.EventHandler(this.d1_Click); + // + // d2 + // + this.d2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d2.Location = new System.Drawing.Point(48, 30); + this.d2.Name = "d2"; + this.d2.Size = new System.Drawing.Size(40, 19); + this.d2.Style = Sunny.UI.UIStyle.Custom; + this.d2.StyleCustomMode = true; + this.d2.TabIndex = 14; + this.d2.Text = "uiLabel19"; + this.d2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d2.Click += new System.EventHandler(this.d1_Click); + // + // uiLabel13 + // + this.uiLabel13.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel13.Location = new System.Drawing.Point(268, 4); + this.uiLabel13.Name = "uiLabel13"; + this.uiLabel13.Size = new System.Drawing.Size(40, 19); + this.uiLabel13.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel13.TabIndex = 13; + this.uiLabel13.Text = "六"; + this.uiLabel13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // uiLabel12 + // + this.uiLabel12.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel12.Location = new System.Drawing.Point(224, 4); + this.uiLabel12.Name = "uiLabel12"; + this.uiLabel12.Size = new System.Drawing.Size(40, 19); + this.uiLabel12.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel12.TabIndex = 12; + this.uiLabel12.Text = "五"; + this.uiLabel12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // uiLabel11 + // + this.uiLabel11.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel11.Location = new System.Drawing.Point(180, 4); + this.uiLabel11.Name = "uiLabel11"; + this.uiLabel11.Size = new System.Drawing.Size(40, 19); + this.uiLabel11.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel11.TabIndex = 11; + this.uiLabel11.Text = "四"; + this.uiLabel11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // uiLabel10 + // + this.uiLabel10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel10.Location = new System.Drawing.Point(136, 4); + this.uiLabel10.Name = "uiLabel10"; + this.uiLabel10.Size = new System.Drawing.Size(40, 19); + this.uiLabel10.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel10.TabIndex = 10; + this.uiLabel10.Text = "三"; + this.uiLabel10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // uiLabel9 + // + this.uiLabel9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel9.Location = new System.Drawing.Point(92, 4); + this.uiLabel9.Name = "uiLabel9"; + this.uiLabel9.Size = new System.Drawing.Size(40, 19); + this.uiLabel9.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel9.TabIndex = 9; + this.uiLabel9.Text = "二"; + this.uiLabel9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // uiLabel7 + // + this.uiLabel7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel7.Location = new System.Drawing.Point(48, 4); + this.uiLabel7.Name = "uiLabel7"; + this.uiLabel7.Size = new System.Drawing.Size(40, 19); + this.uiLabel7.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel7.TabIndex = 8; + this.uiLabel7.Text = "一"; + this.uiLabel7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // d36 + // + this.d36.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d36.Location = new System.Drawing.Point(4, 145); + this.d36.Name = "d36"; + this.d36.Size = new System.Drawing.Size(40, 19); + this.d36.Style = Sunny.UI.UIStyle.Custom; + this.d36.StyleCustomMode = true; + this.d36.TabIndex = 6; + this.d36.Text = "uiLabel8"; + this.d36.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d36.Click += new System.EventHandler(this.d1_Click); + // + // d29 + // + this.d29.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d29.Location = new System.Drawing.Point(4, 122); + this.d29.Name = "d29"; + this.d29.Size = new System.Drawing.Size(40, 19); + this.d29.Style = Sunny.UI.UIStyle.Custom; + this.d29.StyleCustomMode = true; + this.d29.TabIndex = 5; + this.d29.Text = "uiLabel5"; + this.d29.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d29.Click += new System.EventHandler(this.d1_Click); + // + // d22 + // + this.d22.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d22.Location = new System.Drawing.Point(4, 99); + this.d22.Name = "d22"; + this.d22.Size = new System.Drawing.Size(40, 19); + this.d22.Style = Sunny.UI.UIStyle.Custom; + this.d22.StyleCustomMode = true; + this.d22.TabIndex = 4; + this.d22.Text = "uiLabel6"; + this.d22.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d22.Click += new System.EventHandler(this.d1_Click); + // + // d15 + // + this.d15.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d15.Location = new System.Drawing.Point(4, 76); + this.d15.Name = "d15"; + this.d15.Size = new System.Drawing.Size(40, 19); + this.d15.Style = Sunny.UI.UIStyle.Custom; + this.d15.StyleCustomMode = true; + this.d15.TabIndex = 3; + this.d15.Text = "uiLabel3"; + this.d15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d15.Click += new System.EventHandler(this.d1_Click); + // + // d8 + // + this.d8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d8.Location = new System.Drawing.Point(4, 53); + this.d8.Name = "d8"; + this.d8.Size = new System.Drawing.Size(40, 19); + this.d8.Style = Sunny.UI.UIStyle.Custom; + this.d8.StyleCustomMode = true; + this.d8.TabIndex = 2; + this.d8.Text = "uiLabel4"; + this.d8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d8.Click += new System.EventHandler(this.d1_Click); + // + // d1 + // + this.d1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.d1.Location = new System.Drawing.Point(4, 30); + this.d1.Name = "d1"; + this.d1.Size = new System.Drawing.Size(40, 19); + this.d1.Style = Sunny.UI.UIStyle.Custom; + this.d1.StyleCustomMode = true; + this.d1.TabIndex = 1; + this.d1.Text = "uiLabel2"; + this.d1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.d1.Click += new System.EventHandler(this.d1_Click); + // + // uiLabel1 + // + this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLabel1.Location = new System.Drawing.Point(4, 4); + this.uiLabel1.Name = "uiLabel1"; + this.uiLabel1.Size = new System.Drawing.Size(40, 19); + this.uiLabel1.Style = Sunny.UI.UIStyle.Custom; + this.uiLabel1.TabIndex = 0; + this.uiLabel1.Text = "日"; + this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // uiLine1 + // + this.uiLine1.FillColor = System.Drawing.Color.White; + this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.uiLine1.LineColor = System.Drawing.Color.Silver; + this.uiLine1.Location = new System.Drawing.Point(4, 19); + this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16); + this.uiLine1.Name = "uiLine1"; + this.uiLine1.Size = new System.Drawing.Size(304, 16); + this.uiLine1.Style = Sunny.UI.UIStyle.Custom; + this.uiLine1.StyleCustomMode = true; + this.uiLine1.TabIndex = 7; + // + // UIDateTimeItem + // + this.Controls.Add(this.TabControl); + this.Controls.Add(this.TopPanel); + this.FillColor = System.Drawing.Color.White; + this.Name = "UIDateTimeItem"; + this.Size = new System.Drawing.Size(461, 348); + this.Style = Sunny.UI.UIStyle.Custom; + this.TopPanel.ResumeLayout(false); + this.TabControl.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.p1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.p2.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.p3.ResumeLayout(false); + this.ResumeLayout(false); + } + + public UIDateItem() + { + InitializeComponent(); + Width = 312; + Height = 200; + TabControl.TabVisible = false; + + for (int i = 1; i <= 10; i++) + { + var label = this.GetControl("y" + i); + label.MouseEnter += Label_MouseEnter; + label.MouseLeave += Label_MouseLeave; + } + + for (int i = 1; i <= 12; i++) + { + var label = this.GetControl("m" + i); + label.MouseEnter += Label_MouseEnter; + label.MouseLeave += Label_MouseLeave; + } + + for (int i = 1; i <= 42; i++) + { + var label = this.GetControl("d" + i); + label.MouseEnter += Label_MouseEnter; + label.MouseLeave += Label_MouseLeave; + } + } + + private void Label_MouseLeave(object sender, EventArgs e) + { + UILabel label = (UILabel)sender; + if (label.Tag.ToString().Length <= 2) + { + label.ForeColor = UIFontColor.Primary; + } + else + { + DateTime lblDate = (DateTime)label.Tag; + label.ForeColor = (lblDate.Year == Year && lblDate.Month == Month) + ? UIFontColor.Primary + : Color.DarkGray; + + if (lblDate.DateString().Equals(date.DateString())) + { + label.ForeColor = UIColor.Blue; + } + } + } + + private void Label_MouseEnter(object sender, EventArgs e) + { + UILabel label = (UILabel)sender; + label.ForeColor = UIColor.Blue; + } + + private void TopPanel_Click(object sender, EventArgs e) + { + TabControl.SelectedTab = tabPage1; + } + + private void d1_Click(object sender, EventArgs e) + { + date = (DateTime)((UILabel)sender).Tag; + DoValueChanged(this, Date); + CloseParent(); + } + + private DateTime date; + + public DateTime Date + { + get => date; + set + { + date = value; + TabControl.SelectPage(2); + Year = date.Year; + Month = date.Month; + SetYearMonth(Year, Month); + TabControl.SelectedTab = tabPage3; + } + } + + private int year; + + public int Year + { + get => year; + set + { + year = value; + int iy = year / 10 * 10; + for (int i = 1; i <= 10; i++) + { + UILabel label = tabPage1.GetControl("y" + i); + label.Text = (iy + i - 1).ToString(); + } + } + } + + public int Month { get; set; } + + private void SetYearMonth(int iYear, int iMonth) + { + DateTime dt = new DateTime(iYear, iMonth, 1); + int week = (int)dt.DayOfWeek; + + DateTime dtBegin = week == 0 ? dt.AddDays(-7) : dt.AddDays(-week); + for (int i = 1; i <= 42; i++) + { + UILabel label = tabPage3.GetControl("d" + i); + DateTime lblDate = dtBegin.AddDays(i - 1); + label.Text = lblDate.Day.ToString(); + label.Tag = lblDate; + label.ForeColor = (lblDate.Year == iYear && lblDate.Month == iMonth) + ? UIFontColor.Primary + : Color.DarkGray; + + if (lblDate.DateString().Equals(date.DateString())) + { + label.ForeColor = UIColor.Blue; + } + } + + TopPanel.Text = Year + "年" + Month + "月"; + } + + private void TabControl_SelectedIndexChanged(object sender, EventArgs e) + { + b2.Visible = b3.Visible = TabControl.SelectedIndex == 2; + switch (TabControl.SelectedIndex) + { + case 0: + int iy = year / 10 * 10; + TopPanel.Text = iy + "年 - " + (iy + 9) + "年"; + for (int i = 1; i <= 10; i++) + { + UILabel label = tabPage1.GetControl("y" + i); + label.Text = (iy + i - 1).ToString(); + } + break; + + case 1: + TopPanel.Text = Year + "年"; + break; + + case 2: + TopPanel.Text = Year + "年" + Month + "月"; + break; + } + } + + private void y1_Click(object sender, EventArgs e) + { + Year = ((UILabel)sender).Text.ToInt(); + TabControl.SelectedTab = tabPage2; + } + + private void m1_Click(object sender, EventArgs e) + { + Month = ((UILabel)sender).Tag.ToString().ToInt(); + SetYearMonth(Year, Month); + TabControl.SelectedTab = tabPage3; + } + + private void b1_Click(object sender, EventArgs e) + { + switch (TabControl.SelectedIndex) + { + case 0: + Year = year / 10 * 10; + Year -= 10; + TopPanel.Text = Year + "年 - " + (Year + 9) + "年"; + for (int i = 1; i <= 10; i++) + { + UILabel label = tabPage1.GetControl("y" + i); + label.Text = (Year + i - 1).ToString(); + } + break; + + case 1: + Year -= 1; + TopPanel.Text = Year + "年"; + break; + + case 2: + Year -= 1; + SetYearMonth(Year, Month); + break; + } + } + + private void b2_Click(object sender, EventArgs e) + { + DateTime dt = new DateTime(Year, Month, 1); + dt = dt.AddMonths(-1); + Year = dt.Year; + Month = dt.Month; + SetYearMonth(Year, Month); + } + + private void b3_Click(object sender, EventArgs e) + { + DateTime dt = new DateTime(Year, Month, 1); + dt = dt.AddMonths(1); + Year = dt.Year; + Month = dt.Month; + SetYearMonth(Year, Month); + } + + private void b4_Click(object sender, EventArgs e) + { + switch (TabControl.SelectedIndex) + { + case 0: + Year = year / 10 * 10; + Year += 10; + TopPanel.Text = Year + "年 - " + (Year + 9) + "年"; + for (int i = 1; i <= 10; i++) + { + UILabel label = tabPage1.GetControl("y" + i); + label.Text = (Year + i - 1).ToString(); + } + break; + + case 1: + Year += 1; + TopPanel.Text = Year + "年"; + break; + + case 2: + Year += 1; + SetYearMonth(Year, Month); + break; + } + } + + public override void SetRectColor(Color color) + { + base.SetRectColor(color); + RectColor = color; + b1.ForeColor = b2.ForeColor = b3.ForeColor = b4.ForeColor = color; + TopPanel.RectColor = p1.RectColor = p2.RectColor = p3.RectColor = color; + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIDateItem.resx b/SunnyUI/Controls/DropItem/UIDateItem.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SunnyUI/Controls/DropItem/UIDateItem.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIDropControl.cs b/SunnyUI/Controls/DropItem/UIDropControl.cs index 320d06f4..e2cacddb 100644 --- a/SunnyUI/Controls/DropItem/UIDropControl.cs +++ b/SunnyUI/Controls/DropItem/UIDropControl.cs @@ -297,7 +297,7 @@ namespace Sunny.UI ItemForm.SetRectColor(rectColor); ItemForm.SetFillColor(fillColor); ItemForm.SetForeColor(foreColor); - ItemForm.SetStyle(UIStyles.GetStyleColor(UIStyles.Style)); + ItemForm.SetStyle(UIStyles.ActiveStyleColor); } ButtonClick?.Invoke(this, e); diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index bad61f3a..34752f5b 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -52,6 +52,19 @@ namespace Sunny.UI fillPressColor = UIStyles.Blue.ButtonFillPressColor; } + private bool isClick; + + public void PerformClick() + { + if (isClick) return; + if (CanSelect && Enabled) + { + isClick = true; + OnClick(EventArgs.Empty); + isClick = false; + } + } + private bool showTips = false; [Description("是否显示角标"), Category("自定义")] diff --git a/SunnyUI/Controls/UIColorPicker.cs b/SunnyUI/Controls/UIColorPicker.cs new file mode 100644 index 00000000..f1d9fef6 --- /dev/null +++ b/SunnyUI/Controls/UIColorPicker.cs @@ -0,0 +1,106 @@ +/****************************************************************************** + * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。 + * CopyRight (C) 2012-2020 ShenYongHua(沈永华). + * QQ群:56829229 QQ:17612584 EMail:SunnyUI@qq.com + * + * Blog: https://www.cnblogs.com/yhuse + * Gitee: https://gitee.com/yhuse/SunnyUI + * GitHub: https://github.com/yhuse/SunnyUI + * + * SunnyUI.dll can be used for free under the GPL-3.0 license. + * If you use this code, please keep this note. + * 如果您使用此代码,请保留此说明。 + ****************************************************************************** + * 文件名称: UIDatePicker.cs + * 文件说明: 颜色选择框 + * 当前版本: V2.2 + * 创建日期: 2020-05-29 + * + * 2020-05-31: V2.2.5 增加文件 + ****************************************************************************** + * 文件名称: Color picker with color wheel and eye dropper + * 文件说明: Color picker with color wheel and eye dropper + * 文件作者: jkristia + * 开源协议: CPOL + * 引用地址: https://www.codeproject.com/Articles/21965/Color-Picker-with-Color-Wheel-and-Eye-Dropper +******************************************************************************/ + +using System; +using System.ComponentModel; +using System.Drawing; + +namespace Sunny.UI +{ + [ToolboxItem(true)] + public sealed class UIColorPicker : UIDropControl + { + private void InitializeComponent() + { + this.SuspendLayout(); + // + // UIColorPicker + // + this.DropDownStyle = UIDropDownStyle.DropDownList; + this.Name = "UIColorPicker"; + this.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0); + this.ButtonClick += new System.EventHandler(this.UIColorPicker_ButtonClick); + this.PaintOther += new System.Windows.Forms.PaintEventHandler(this.UIColorPicker_PaintOther); + this.ResumeLayout(false); + this.PerformLayout(); + } + + public delegate void OnColorChanged(object sender, Color value); + + public event OnColorChanged ValueChanged; + + public UIColorPicker() + { + InitializeComponent(); + ShowText = false; + Value = UIColor.Blue; + } + + private void UIColorPicker_ButtonClick(object sender, EventArgs e) + { + item.SelectedColor = Value; + ItemForm.Show(this); + } + + protected override void ItemForm_ValueChanged(object sender, object value) + { + Value = (Color)value; + Invalidate(); + ValueChanged?.Invoke(this, Value); + } + + private readonly UIColorItem item = new UIColorItem(); + + protected override void CreateInstance() + { + ItemForm = new UIDropDown(item); + } + + private Color selectColor; + + public Color Value + { + get => selectColor; + set + { + selectColor = value; + item.SelectedColor = value; + Invalidate(); + } + } + + private void UIColorPicker_PaintOther(object sender, System.Windows.Forms.PaintEventArgs e) + { + var pathColor = e.Graphics.CreateRoundedRectanglePath(new Rectangle(3, 3, Width - 32, Height - 7), 5, + UICornerRadiusSides.All); + e.Graphics.FillPath(Value, pathColor); + + if (DropDownStyle != UIDropDownStyle.DropDownList) + DropDownStyle = UIDropDownStyle.DropDownList; + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/UIColorPicker.resx b/SunnyUI/Controls/UIColorPicker.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SunnyUI/Controls/UIColorPicker.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SunnyUI/Controls/UIDatePicker.cs b/SunnyUI/Controls/UIDatePicker.cs index 49944fb0..981b0c8a 100644 --- a/SunnyUI/Controls/UIDatePicker.cs +++ b/SunnyUI/Controls/UIDatePicker.cs @@ -21,7 +21,6 @@ using System; using System.ComponentModel; -using System.Windows.Forms; namespace Sunny.UI { @@ -46,7 +45,7 @@ namespace Sunny.UI ValueChanged?.Invoke(this, Value); } - private readonly UIDateTimeItem item = new UIDateTimeItem(); + private readonly UIDateItem item = new UIDateItem(); protected override void CreateInstance() { diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index a0762acb..c8b0eea8 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -458,28 +458,8 @@ namespace Sunny.UI /// private Point location; - /// - /// 获取当前鼠标活动区域所属的监视器 - /// - /// Screen - private int GetMouseInScreen(Point mPnt) - { - int screenIndex = 0; - for (int i = 0; i < Screen.AllScreens.Length; i++) - { - if (mPnt.InRect(Screen.AllScreens[i].Bounds)) - { - screenIndex = i; - break; - } - } - - return screenIndex; - } - private void ShowMaximize(bool IsOnMoving = false) { - //int screenIndex = GetMouseInScreen(MousePosition); Screen screen = Screen.FromPoint(MousePosition); if (windowState == FormWindowState.Normal) { @@ -613,9 +593,7 @@ namespace Sunny.UI protected override void OnMouseMove(MouseEventArgs e) { - Point pt = MousePosition; - - if (FormMoveMouseDown && !pt.Equals(mouseOffset)) + if (FormMoveMouseDown && !MousePosition.Equals(mouseOffset)) { if (this.windowState == FormWindowState.Maximized) { @@ -627,8 +605,8 @@ namespace Sunny.UI mouseOffset.X -= (int)((mouseOffset.X - LocationX) * offsetXRatio); } - int offsetX = mouseOffset.X - pt.X; - int offsetY = mouseOffset.Y - pt.Y; + int offsetX = mouseOffset.X - MousePosition.X; + int offsetY = mouseOffset.Y - MousePosition.Y; Rectangle WorkingArea = Screen.GetWorkingArea(this); // 若当前鼠标停留在容器上边缘,将会触发一个时间为MaximumBorderInterval(ms)的边缘等待, @@ -731,7 +709,6 @@ namespace Sunny.UI if (ShowRect) { Point[] points; - bool unShowRadius = !ShowRadius || windowState == FormWindowState.Maximized || (Width == Screen.PrimaryScreen.WorkingArea.Width && Height == Screen.PrimaryScreen.WorkingArea.Height); @@ -1033,7 +1010,7 @@ namespace Sunny.UI { if (ctrl != null && !ctrl.IsDisposed) { - ctrl.MouseDown += ctrlMouseDown; + ctrl.MouseDown += CtrlMouseDown; } } } @@ -1043,7 +1020,7 @@ namespace Sunny.UI /// /// The source of the event. /// The instance containing the event data. - private void ctrlMouseDown(object sender, MouseEventArgs e) + private void CtrlMouseDown(object sender, MouseEventArgs e) { if (windowState == FormWindowState.Maximized) { diff --git a/SunnyUI/Properties/Resources.Designer.cs b/SunnyUI/Properties/Resources.Designer.cs index 8b2ca963..aa93f6c2 100644 --- a/SunnyUI/Properties/Resources.Designer.cs +++ b/SunnyUI/Properties/Resources.Designer.cs @@ -70,6 +70,16 @@ namespace Sunny.UI.Properties { } } + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap colorbarIndicators { + get { + object obj = ResourceManager.GetObject("colorbarIndicators", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// diff --git a/SunnyUI/Properties/Resources.resx b/SunnyUI/Properties/Resources.resx index 94c20f3b..78db086c 100644 --- a/SunnyUI/Properties/Resources.resx +++ b/SunnyUI/Properties/Resources.resx @@ -121,6 +121,9 @@ ..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\colorbarIndicators.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\gps1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/SunnyUI/Resources/colorbarIndicators.bmp b/SunnyUI/Resources/colorbarIndicators.bmp new file mode 100644 index 00000000..44f8eac6 Binary files /dev/null and b/SunnyUI/Resources/colorbarIndicators.bmp differ diff --git a/SunnyUI/Static/UImage.cs b/SunnyUI/Static/UImage.cs index de292c9c..e47f3dd0 100644 --- a/SunnyUI/Static/UImage.cs +++ b/SunnyUI/Static/UImage.cs @@ -25,6 +25,7 @@ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Net; +using System.Windows.Forms; namespace Sunny.UI { @@ -39,6 +40,16 @@ namespace Sunny.UI /// public static class ImageEx { + public static ImageList GetToolbarImageList(Type type, Bitmap bitmap, Size imageSize, Color transparentColor) + { + ImageList imageList = new ImageList(); + imageList.ImageSize = imageSize; + imageList.TransparentColor = transparentColor; + imageList.Images.AddStrip(bitmap); + imageList.ColorDepth = ColorDepth.Depth24Bit; + return imageList; + } + public static Bitmap Split(this Bitmap image, int size, UIShape shape) { //截图画板 diff --git a/SunnyUI/Style/UIStyle.cs b/SunnyUI/Style/UIStyle.cs index 73ada75c..ab20b1f3 100644 --- a/SunnyUI/Style/UIStyle.cs +++ b/SunnyUI/Style/UIStyle.cs @@ -413,6 +413,11 @@ namespace Sunny.UI } } + public static UIBaseStyle ActiveStyleColor + { + get => GetStyleColor(Style); + } + private static void AddStyle(UIBaseStyle uiColor) { if (Styles.ContainsKey(uiColor.Name)) diff --git a/SunnyUI/SunnyUI.csproj b/SunnyUI/SunnyUI.csproj index c84a6818..ac9b853e 100644 --- a/SunnyUI/SunnyUI.csproj +++ b/SunnyUI/SunnyUI.csproj @@ -51,12 +51,28 @@ + + Component + + + Component + + + Component + + + + Component + UserControl UIComboBoxItem.cs + + UserControl + UserControl @@ -72,6 +88,9 @@ UserControl + + UserControl + UserControl @@ -337,6 +356,9 @@ + + UserControl + Component @@ -421,9 +443,18 @@ + + UIColorItem.cs + + + UIColorTable.cs + UIComboBoxItem.cs + + UIDateItem.cs + UIDateTimeItem.cs @@ -522,6 +553,9 @@ UISelectForm.cs + + UIColorPicker.cs + @@ -563,6 +597,9 @@ + + +