+ UIBarChart:新增ToolTip显示;+ UINavMenu:新增TipsText气泡数字显示

This commit is contained in:
Sunny 2020-06-16 23:26:53 +08:00
parent 7608291778
commit d25c38063f
19 changed files with 198 additions and 68 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,6 +45,7 @@
this.Aside.ItemHeight = 36; this.Aside.ItemHeight = 36;
this.Aside.LineColor = System.Drawing.Color.Black; this.Aside.LineColor = System.Drawing.Color.Black;
this.Aside.ShowOneNode = true; this.Aside.ShowOneNode = true;
this.Aside.ShowTips = true;
this.Aside.Size = new System.Drawing.Size(250, 575); this.Aside.Size = new System.Drawing.Size(250, 575);
// //
// Header // Header

View File

@ -35,6 +35,7 @@ namespace Sunny.UI.Demo
Aside.CreateChildNode(parent, 62104, 24, AddPage(new FContextMenuStrip(), ++pageIndex)); Aside.CreateChildNode(parent, 62104, 24, AddPage(new FContextMenuStrip(), ++pageIndex));
Aside.CreateChildNode(parent, 61668, 24, AddPage(new FMeter(), ++pageIndex)); Aside.CreateChildNode(parent, 61668, 24, AddPage(new FMeter(), ++pageIndex));
Aside.CreateChildNode(parent, 62173, 24, AddPage(new FOther(), ++pageIndex)); Aside.CreateChildNode(parent, 62173, 24, AddPage(new FOther(), ++pageIndex));
Aside.SetNodeTipsText(parent.Nodes[0],"1");
pageIndex = 2000; pageIndex = 2000;
Header.SetNodePageIndex(Header.Nodes[1], pageIndex); Header.SetNodePageIndex(Header.Nodes[1], pageIndex);

View File

@ -3,7 +3,9 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;
using System.Windows.Forms;
namespace Sunny.UI namespace Sunny.UI
{ {
@ -64,8 +66,7 @@ namespace Sunny.UI
YAxisEnd = end; YAxisEnd = end;
YAxisInterval = interval; YAxisInterval = interval;
float x1 = 100.0f / ((o.XAxis.Data.Count * 2) + o.XAxis.Data.Count + 1); float x1 = DrawBarWidth / ((o.SeriesCount * 2) + o.SeriesCount + 1);
x1 = DrawSize.Width * x1 / 100.0f / o.SeriesCount;
float x2 = x1 * 2; float x2 = x1 * 2;
for (int i = 0; i < o.SeriesCount; i++) for (int i = 0; i < o.SeriesCount; i++)
@ -97,8 +98,21 @@ namespace Sunny.UI
barX += DrawBarWidth; barX += DrawBarWidth;
} }
} }
for (int i = 0; i < BarOption.XAxis.Data.Count; i++)
{
string str = BarOption.XAxis.Data[i];
foreach (var series in BarOption.Series)
{
str += '\n';
str += series.Name + " : " + series.Data[i].ToString(BarOption.ToolTip.ValueFormat);
}
Bars[0][i].Tips = str;
}
} }
private int selectIndex = -1;
private Point DrawOrigin; private Point DrawOrigin;
private Size DrawSize; private Size DrawSize;
private float DrawBarWidth; private float DrawBarWidth;
@ -107,6 +121,52 @@ namespace Sunny.UI
private double YAxisInterval; private double YAxisInterval;
private readonly ConcurrentDictionary<int, List<BarInfo>> Bars = new ConcurrentDictionary<int, List<BarInfo>>(); private readonly ConcurrentDictionary<int, List<BarInfo>> Bars = new ConcurrentDictionary<int, List<BarInfo>>();
[DefaultValue(-1), Browsable(false)]
private int SelectIndex
{
get => selectIndex;
set
{
if (BarOption.ToolTip != null && selectIndex != value)
{
selectIndex = value;
Invalidate();
}
if (selectIndex < 0) tip.Visible = false;
}
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (BarOption.ToolTip == null) return;
if (e.Location.X > BarOption.Grid.Left && e.Location.X < Width - BarOption.Grid.Right
&& e.Location.Y > BarOption.Grid.Top &&
e.Location.Y < Height - BarOption.Grid.Bottom)
{
SelectIndex = (int)((e.Location.X - BarOption.Grid.Left) / DrawBarWidth);
}
else
{
SelectIndex = -1;
}
if (SelectIndex >= 0)
{
if (tip.Text != Bars[0][selectIndex].Tips)
{
tip.Text = Bars[0][selectIndex].Tips;
tip.Size = new Size((int)Bars[0][selectIndex].Size.Width + 4, (int)Bars[0][selectIndex].Size.Height + 4);
}
tip.Left = e.Location.X + 15;
tip.Top = e.Location.Y + 20;
if (!tip.Visible) tip.Visible = Bars[0][selectIndex].Tips.IsValid();
}
}
[Browsable(false)] [Browsable(false)]
private UIBarOption BarOption private UIBarOption BarOption
{ {
@ -158,6 +218,9 @@ namespace Sunny.UI
option.XAxis.Data.Add("Thu"); option.XAxis.Data.Add("Thu");
option.XAxis.Data.Add("Fri"); option.XAxis.Data.Add("Fri");
option.ToolTip = new UIBarToolTip();
option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
emptyOption = option; emptyOption = option;
} }
@ -165,12 +228,31 @@ namespace Sunny.UI
{ {
if (BarOption == null) return; if (BarOption == null) return;
if (!NeedDraw) return; if (!NeedDraw) return;
if (BarOption.ToolTip != null && BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Shadow) DrawToolTip(g);
DrawAxis(g); DrawAxis(g);
DrawTitle(g, BarOption.Title); DrawTitle(g, BarOption.Title);
DrawSeries(g, BarOption.Series); DrawSeries(g, BarOption.Series);
if (BarOption.ToolTip != null && BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Line) DrawToolTip(g);
DrawLegend(g, BarOption.Legend); DrawLegend(g, BarOption.Legend);
} }
private void DrawToolTip(Graphics g)
{
if (selectIndex < 0) return;
if (BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Line)
{
float x = DrawOrigin.X + SelectIndex * DrawBarWidth + DrawBarWidth / 2.0f;
g.DrawLine(ChartStyle.ToolTipShadowColor, x, DrawOrigin.Y, x, BarOption.Grid.Top);
}
if (BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Shadow)
{
float x = DrawOrigin.X + SelectIndex * DrawBarWidth;
g.FillRectangle(ChartStyle.ToolTipShadowColor, x, BarOption.Grid.Top, DrawBarWidth, Height - BarOption.Grid.Top - BarOption.Grid.Bottom);
}
}
private void DrawAxis(Graphics g) private void DrawAxis(Graphics g)
{ {
g.DrawLine(ChartStyle.ForeColor, DrawOrigin, new Point(DrawOrigin.X + DrawSize.Width, DrawOrigin.Y)); g.DrawLine(ChartStyle.ForeColor, DrawOrigin, new Point(DrawOrigin.X + DrawSize.Width, DrawOrigin.Y));
@ -206,7 +288,7 @@ namespace Sunny.UI
foreach (var data in BarOption.XAxis.Data) foreach (var data in BarOption.XAxis.Data)
{ {
SizeF sf = g.MeasureString(data, SubFont); SizeF sf = g.MeasureString(data, SubFont);
g.DrawString(data, SubFont, ChartStyle.ForeColor, start - sf.Width / 2.0f, DrawOrigin.Y + BarOption.XAxis.AxisTick.Length); g.DrawString(data, SubFont, Color.FromArgb(150, ChartStyle.ForeColor), start - sf.Width / 2.0f, DrawOrigin.Y + BarOption.XAxis.AxisTick.Length);
start += DrawBarWidth; start += DrawBarWidth;
} }
} }
@ -218,6 +300,17 @@ namespace Sunny.UI
for (int i = YAxisStart; i <= YAxisEnd; i++) for (int i = YAxisStart; i <= YAxisEnd; i++)
{ {
g.DrawLine(ChartStyle.ForeColor, DrawOrigin.X, start, DrawOrigin.X - BarOption.YAxis.AxisTick.Length, start); g.DrawLine(ChartStyle.ForeColor, DrawOrigin.X, start, DrawOrigin.X - BarOption.YAxis.AxisTick.Length, start);
if (i != 0)
{
using (Pen pn = new Pen(ChartStyle.ForeColor))
{
pn.DashStyle = DashStyle.Dash;
pn.DashPattern = new float[] { 3, 3 };
g.DrawLine(pn, DrawOrigin.X, start, Width - BarOption.Grid.Right, start);
}
}
start -= DrawBarHeight; start -= DrawBarHeight;
} }
} }
@ -249,11 +342,20 @@ namespace Sunny.UI
g.FillRectangle(ChartStyle.SeriesColor[i], info.Rect); g.FillRectangle(ChartStyle.SeriesColor[i], info.Rect);
} }
} }
for (int i = 0; i < BarOption.XAxis.Data.Count; i++)
{
Bars[0][i].Size = g.MeasureString(Bars[0][i].Tips, SubFont);
}
} }
internal class BarInfo internal class BarInfo
{ {
public RectangleF Rect { get; set; } public RectangleF Rect { get; set; }
public string Tips { get; set; }
public SizeF Size { get; set; }
} }
} }
} }

View File

@ -7,6 +7,8 @@ namespace Sunny.UI
{ {
public UICategoryAxis XAxis { get; set; } = new UICategoryAxis(); public UICategoryAxis XAxis { get; set; } = new UICategoryAxis();
public UIBarToolTip ToolTip { get; set; }
public UIValueAxis YAxis { get; set; } = new UIValueAxis(); public UIValueAxis YAxis { get; set; } = new UIValueAxis();
public List<UIBarSeries> Series = new List<UIBarSeries>(); public List<UIBarSeries> Series = new List<UIBarSeries>();
@ -35,6 +37,25 @@ namespace Sunny.UI
public int SeriesCount => Series.Count; public int SeriesCount => Series.Count;
} }
public class UIBarToolTip
{
public string Formatter { get; set; } = "{{b}} : {{c}}";
public string ValueFormat { get; set; } = "F0";
public UIAxisPointer AxisPointer= new UIAxisPointer();
}
public class UIAxisPointer
{
public UIAxisPointerType Type { get; set; } = UIAxisPointerType.Line;
}
public enum UIAxisPointerType
{
Line,Shadow
}
public class UIAxis public class UIAxis
{ {
public string Name { get; set; } public string Name { get; set; }

View File

@ -8,6 +8,8 @@ namespace Sunny.UI
public virtual Color ForeColor => Color.FromArgb(54, 54, 54); public virtual Color ForeColor => Color.FromArgb(54, 54, 54);
public virtual Color ToolTipShadowColor => Color.FromArgb(215, 215, 215);
public int ColorCount => 11; public int ColorCount => 11;
public virtual Color[] SeriesColor public virtual Color[] SeriesColor
@ -66,6 +68,8 @@ namespace Sunny.UI
public override Color ForeColor => Color.FromArgb(239, 239, 239); public override Color ForeColor => Color.FromArgb(239, 239, 239);
public override Color ToolTipShadowColor => Color.FromArgb(81, 81, 81);
public override Color[] SeriesColor public override Color[] SeriesColor
{ {
get get

View File

@ -74,10 +74,7 @@ namespace Sunny.UI
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)
{ {
using (SolidBrush b = new SolidBrush(BackColor)) e.Graphics.FillRectangle(BackColor, ClientRectangle);
{
e.Graphics.FillRectangle(b, ClientRectangle);
}
RectangleF lr = ClientRectangleF; RectangleF lr = ClientRectangleF;
UIColorUtil.DrawFrame(e.Graphics, lr, 6, m_frameColor); UIColorUtil.DrawFrame(e.Graphics, lr, 6, m_frameColor);
@ -112,9 +109,9 @@ namespace Sunny.UI
using (SolidBrush b = new SolidBrush(ForeColor)) using (SolidBrush b = new SolidBrush(ForeColor))
{ {
if (TextAngle == 0) if (TextAngle.EqualsFloat(0))
{ {
e.Graphics.DrawString(Text, Font, b, r, format); e.Graphics.DrawString(Text, Font, ForeColor, r, format);
} }
else else
{ {

View File

@ -44,9 +44,9 @@ namespace Sunny.UI
this.btnOK = new Sunny.UI.UISymbolButton(); this.btnOK = new Sunny.UI.UISymbolButton();
this.btnCancel = new Sunny.UI.UISymbolButton(); this.btnCancel = new Sunny.UI.UISymbolButton();
this.SuspendLayout(); this.SuspendLayout();
// //
// m_colorTable // m_colorTable
// //
this.m_colorTable.BackColor = System.Drawing.Color.Transparent; this.m_colorTable.BackColor = System.Drawing.Color.Transparent;
this.m_colorTable.Colors = new System.Drawing.Color[] { this.m_colorTable.Colors = new System.Drawing.Color[] {
System.Drawing.Color.Black, System.Drawing.Color.Black,
@ -206,9 +206,9 @@ namespace Sunny.UI
this.m_colorTable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.m_colorTable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.m_colorTable.TextAngle = 0F; this.m_colorTable.TextAngle = 0F;
this.m_colorTable.SelectedIndexChanged += new System.EventHandler(this.m_colorTable_SelectedIndexChanged); this.m_colorTable.SelectedIndexChanged += new System.EventHandler(this.m_colorTable_SelectedIndexChanged);
// //
// m_colorSample // m_colorSample
// //
this.m_colorSample.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); 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.Location = new System.Drawing.Point(10, 163);
this.m_colorSample.Name = "m_colorSample"; this.m_colorSample.Name = "m_colorSample";
@ -222,9 +222,9 @@ namespace Sunny.UI
this.m_colorSample.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.m_colorSample.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.m_colorSample.TextAngle = 0F; this.m_colorSample.TextAngle = 0F;
this.m_colorSample.Paint += new System.Windows.Forms.PaintEventHandler(this.m_colorSample_Paint); this.m_colorSample.Paint += new System.Windows.Forms.PaintEventHandler(this.m_colorSample_Paint);
// //
// edtA // edtA
// //
this.edtA.Cursor = System.Windows.Forms.Cursors.IBeam; this.edtA.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtA.FillColor = System.Drawing.Color.White; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -241,9 +241,9 @@ namespace Sunny.UI
this.edtA.TabIndex = 2; this.edtA.TabIndex = 2;
this.edtA.Text = "0"; this.edtA.Text = "0";
this.edtA.Type = Sunny.UI.UITextBox.UIEditType.Integer; this.edtA.Type = Sunny.UI.UITextBox.UIEditType.Integer;
// //
// edtR // edtR
// //
this.edtR.Cursor = System.Windows.Forms.Cursors.IBeam; this.edtR.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtR.FillColor = System.Drawing.Color.White; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -260,9 +260,9 @@ namespace Sunny.UI
this.edtR.TabIndex = 3; this.edtR.TabIndex = 3;
this.edtR.Text = "0"; this.edtR.Text = "0";
this.edtR.Type = Sunny.UI.UITextBox.UIEditType.Integer; this.edtR.Type = Sunny.UI.UITextBox.UIEditType.Integer;
// //
// edtG // edtG
// //
this.edtG.Cursor = System.Windows.Forms.Cursors.IBeam; this.edtG.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtG.FillColor = System.Drawing.Color.White; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -279,9 +279,9 @@ namespace Sunny.UI
this.edtG.TabIndex = 4; this.edtG.TabIndex = 4;
this.edtG.Text = "0"; this.edtG.Text = "0";
this.edtG.Type = Sunny.UI.UITextBox.UIEditType.Integer; this.edtG.Type = Sunny.UI.UITextBox.UIEditType.Integer;
// //
// edtB // edtB
// //
this.edtB.Cursor = System.Windows.Forms.Cursors.IBeam; this.edtB.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtB.FillColor = System.Drawing.Color.White; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -298,9 +298,9 @@ namespace Sunny.UI
this.edtB.TabIndex = 5; this.edtB.TabIndex = 5;
this.edtB.Text = "0"; this.edtB.Text = "0";
this.edtB.Type = Sunny.UI.UITextBox.UIEditType.Integer; this.edtB.Type = Sunny.UI.UITextBox.UIEditType.Integer;
// //
// lblA // lblA
// //
this.lblA.AutoSize = true; this.lblA.AutoSize = true;
this.lblA.BackColor = System.Drawing.Color.Transparent; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -311,9 +311,9 @@ namespace Sunny.UI
this.lblA.TabIndex = 6; this.lblA.TabIndex = 6;
this.lblA.Text = "A"; this.lblA.Text = "A";
this.lblA.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblA.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// lblR // lblR
// //
this.lblR.AutoSize = true; this.lblR.AutoSize = true;
this.lblR.BackColor = System.Drawing.Color.Transparent; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -324,9 +324,9 @@ namespace Sunny.UI
this.lblR.TabIndex = 7; this.lblR.TabIndex = 7;
this.lblR.Text = "R"; this.lblR.Text = "R";
this.lblR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// lblG // lblG
// //
this.lblG.AutoSize = true; this.lblG.AutoSize = true;
this.lblG.BackColor = System.Drawing.Color.Transparent; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -337,9 +337,9 @@ namespace Sunny.UI
this.lblG.TabIndex = 8; this.lblG.TabIndex = 8;
this.lblG.Text = "G"; this.lblG.Text = "G";
this.lblG.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblG.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// lblB // lblB
// //
this.lblB.AutoSize = true; this.lblB.AutoSize = true;
this.lblB.BackColor = System.Drawing.Color.Transparent; 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.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -350,9 +350,9 @@ namespace Sunny.UI
this.lblB.TabIndex = 9; this.lblB.TabIndex = 9;
this.lblB.Text = "B"; this.lblB.Text = "B";
this.lblB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// m_colorWheel // m_colorWheel
// //
this.m_colorWheel.BackColor = System.Drawing.Color.Transparent; 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.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.Location = new System.Drawing.Point(269, 8);
@ -365,9 +365,9 @@ namespace Sunny.UI
this.m_colorWheel.TagString = null; this.m_colorWheel.TagString = null;
this.m_colorWheel.Text = "colorWheel1"; this.m_colorWheel.Text = "colorWheel1";
this.m_colorWheel.SelectedColorChanged += new System.EventHandler(this.m_colorWheel_SelectedColorChanged); this.m_colorWheel.SelectedColorChanged += new System.EventHandler(this.m_colorWheel_SelectedColorChanged);
// //
// m_colorBar // m_colorBar
// //
this.m_colorBar.BackColor = System.Drawing.Color.Transparent; this.m_colorBar.BackColor = System.Drawing.Color.Transparent;
this.m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10); this.m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10);
this.m_colorBar.Color1 = System.Drawing.Color.Black; this.m_colorBar.Color1 = System.Drawing.Color.Black;
@ -392,9 +392,9 @@ namespace Sunny.UI
this.m_colorBar.TextAngle = 270F; this.m_colorBar.TextAngle = 270F;
this.m_colorBar.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MaxToMin; this.m_colorBar.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MaxToMin;
this.m_colorBar.SelectedValueChanged += new System.EventHandler(this.m_colorBar_SelectedValueChanged); this.m_colorBar.SelectedValueChanged += new System.EventHandler(this.m_colorBar_SelectedValueChanged);
// //
// m_opacitySlider // m_opacitySlider
// //
this.m_opacitySlider.BackColor = System.Drawing.Color.Transparent; this.m_opacitySlider.BackColor = System.Drawing.Color.Transparent;
this.m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25); this.m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25);
this.m_opacitySlider.Color1 = System.Drawing.Color.White; this.m_opacitySlider.Color1 = System.Drawing.Color.White;
@ -420,9 +420,9 @@ namespace Sunny.UI
this.m_opacitySlider.TextAngle = 0F; this.m_opacitySlider.TextAngle = 0F;
this.m_opacitySlider.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MinToMax; this.m_opacitySlider.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MinToMax;
this.m_opacitySlider.SelectedValueChanged += new System.EventHandler(this.m_opacitySlider_SelectedValueChanged); this.m_opacitySlider.SelectedValueChanged += new System.EventHandler(this.m_opacitySlider_SelectedValueChanged);
// //
// btnOK // btnOK
// //
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand; this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F); this.btnOK.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnOK.Location = new System.Drawing.Point(269, 197); this.btnOK.Location = new System.Drawing.Point(269, 197);
@ -433,9 +433,9 @@ namespace Sunny.UI
this.btnOK.TabIndex = 12; this.btnOK.TabIndex = 12;
this.btnOK.Text = "确定"; this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click); this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
// //
// btnCancel // btnCancel
// //
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F); this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnCancel.Location = new System.Drawing.Point(372, 197); this.btnCancel.Location = new System.Drawing.Point(372, 197);
@ -447,9 +447,9 @@ namespace Sunny.UI
this.btnCancel.TabIndex = 13; this.btnCancel.TabIndex = 13;
this.btnCancel.Text = "取消"; this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// UIColorItem // UIColorItem
// //
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK); this.Controls.Add(this.btnOK);
this.Controls.Add(this.m_opacitySlider); this.Controls.Add(this.m_opacitySlider);
@ -471,7 +471,6 @@ namespace Sunny.UI
this.Style = Sunny.UI.UIStyle.Custom; this.Style = Sunny.UI.UIStyle.Custom;
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e) private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e)
@ -566,15 +565,13 @@ namespace Sunny.UI
r.Width /= 2; r.Width /= 2;
Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor); Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor);
SolidBrush b = new SolidBrush(c); e.Graphics.FillRectangle(c, r);
e.Graphics.FillRectangle(b, r);
r.X += r.Width; r.X += r.Width;
e.Graphics.FillRectangle(Brushes.White, r); e.Graphics.FillRectangle(Color.White, r);
c = Color.FromArgb(255, m_selectedColor); c = Color.FromArgb(255, m_selectedColor);
b = new SolidBrush(c); e.Graphics.FillRectangle(c, r);
e.Graphics.FillRectangle(b, r);
} }
public override void SetStyle(UIBaseStyle uiColor) public override void SetStyle(UIBaseStyle uiColor)

View File

@ -133,8 +133,8 @@ namespace Sunny.UI
float sfMax = Math.Max(sf.Width, sf.Height); float sfMax = Math.Max(sf.Width, sf.Height);
float x = Width - 1 - 2 - sfMax; float x = Width - 1 - 2 - sfMax;
float y = 1 + 1; float y = 1 + 1;
e.Graphics.FillEllipse(Brushes.Red, x, y, sfMax, sfMax); e.Graphics.FillEllipse(UIColor.Red, x, y, sfMax, sfMax);
e.Graphics.DrawString(TipsText, TipsFont, Brushes.White, x + sfMax / 2.0f - sf.Width / 2.0f, y + sfMax / 2.0f - sf.Height / 2.0f); e.Graphics.DrawString(TipsText, TipsFont, Color.White, x + sfMax / 2.0f - sf.Width / 2.0f, y + sfMax / 2.0f - sf.Height / 2.0f);
} }
} }

View File

@ -143,7 +143,7 @@ namespace Sunny.UI
// Draw the background ellipse // Draw the background ellipse
var rectangle = new Rectangle(Padding.Left, Padding.Top, diameter, diameter); var rectangle = new Rectangle(Padding.Left, Padding.Top, diameter, diameter);
g.FillEllipse(new SolidBrush(darkColor), rectangle); g.FillEllipse(darkColor, rectangle);
// Draw the glow gradient // Draw the glow gradient
var path = new GraphicsPath(); var path = new GraphicsPath();
@ -152,6 +152,7 @@ namespace Sunny.UI
pathBrush.CenterColor = lightColor; pathBrush.CenterColor = lightColor;
pathBrush.SurroundColors = new[] { Color.FromArgb(0, lightColor) }; pathBrush.SurroundColors = new[] { Color.FromArgb(0, lightColor) };
g.FillEllipse(pathBrush, rectangle); g.FillEllipse(pathBrush, rectangle);
pathBrush.Dispose();
// Draw the white reflection gradient // Draw the white reflection gradient
var offset = Convert.ToInt32(diameter * .15F); var offset = Convert.ToInt32(diameter * .15F);
@ -163,6 +164,7 @@ namespace Sunny.UI
pathBrush1.CenterColor = _reflectionColor; pathBrush1.CenterColor = _reflectionColor;
pathBrush1.SurroundColors = _surroundColor; pathBrush1.SurroundColors = _surroundColor;
g.FillEllipse(pathBrush1, whiteRect); g.FillEllipse(pathBrush1, whiteRect);
pathBrush1.Dispose();
// Draw the border // Draw the border
g.SetClip(ClientRectangle); g.SetClip(ClientRectangle);

View File

@ -55,12 +55,12 @@ namespace Sunny.UI
int n1 = 66; int n1 = 66;
int n3 = -20; int n3 = -20;
g.FillPie(new SolidBrush(UIColor.Blue), x, y, n1, n1, -30, 60); g.FillPie(UIColor.Blue, x, y, n1, n1, -30, 60);
g.FillPie(new SolidBrush(UIColor.Gray), x, y, n1, n1, 30, 60); g.FillPie(UIColor.Gray, x, y, n1, n1, 30, 60);
g.FillPie(new SolidBrush(UIColor.Red), x, y, n1, n1, 90, 60); g.FillPie(UIColor.Red, x, y, n1, n1, 90, 60);
g.FillPie(new SolidBrush(UIColor.Orange), x, y, n1, n1, 150, 60); g.FillPie(UIColor.Orange, x, y, n1, n1, 150, 60);
g.FillPie(new SolidBrush(Color.FromArgb(255, 196, 0)), x, y, n1, n1, 210, 60); g.FillPie(Color.FromArgb(255, 196, 0), x, y, n1, n1, 210, 60);
g.FillPie(new SolidBrush(UIColor.Green), x, y, n1, n1, 270, 60); g.FillPie(UIColor.Green, x, y, n1, n1, 270, 60);
g.FillEllipse(BackColor, x - n3, y - n3, n1 + n3 * 2, n1 + n3 * 2); g.FillEllipse(BackColor, x - n3, y - n3, n1 + n3 * 2, n1 + n3 * 2);
g.SetHighQuality(); g.SetHighQuality();

View File

@ -351,6 +351,11 @@ namespace Sunny.UI
MenuHelper.SetPageIndex(node, pageIndex); MenuHelper.SetPageIndex(node, pageIndex);
} }
public void SetNodeTipsText(TreeNode node, string tipsText)
{
MenuHelper.SetTipsText(node,tipsText);
}
public void SetNodeSymbol(TreeNode node, int symbol, int symbolSize = 24) public void SetNodeSymbol(TreeNode node, int symbol, int symbolSize = 24)
{ {
MenuHelper.SetSymbol(node, symbol, symbolSize); MenuHelper.SetSymbol(node, symbol, symbolSize);
@ -443,8 +448,8 @@ namespace Sunny.UI
float tipsLeft = Width - (ScrollBarVisible ? 50 : 30) - 6 - sfMax; float tipsLeft = Width - (ScrollBarVisible ? 50 : 30) - 6 - sfMax;
float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2; float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2;
e.Graphics.FillEllipse(Brushes.Red, tipsLeft, tipsTop, sfMax, sfMax); e.Graphics.FillEllipse(UIColor.Red, tipsLeft, tipsTop, sfMax, sfMax);
e.Graphics.DrawString(MenuHelper.GetTipsText(e.Node), TipsFont, Brushes.White, tipsLeft + sfMax / 2.0f - tipsSize.Width / 2.0f, tipsTop + sfMax / 2.0f - tipsSize.Height / 2.0f); e.Graphics.DrawString(MenuHelper.GetTipsText(e.Node), TipsFont, Color.White, tipsLeft + sfMax / 2.0f - tipsSize.Width / 2.0f, tipsTop + 1 + sfMax / 2.0f - tipsSize.Height / 2.0f);
} }
} }
} }

View File

@ -101,7 +101,6 @@ namespace Sunny.UI
Helper.AddPage(guid, page); Helper.AddPage(guid, page);
} }
public string Version { get; } public string Version { get; }
private Color _fillColor = UIColor.LightBlue; private Color _fillColor = UIColor.LightBlue;
@ -607,11 +606,8 @@ namespace Sunny.UI
g.SmoothingMode = SmoothingMode.AntiAlias; g.SmoothingMode = SmoothingMode.AntiAlias;
Color color = Enabled ? BackColor : SystemColors.Control; Color color = Enabled ? BackColor : SystemColors.Control;
using (SolidBrush brush = new SolidBrush(color)) rect.Inflate(1, 1);
{ g.FillRectangle(color, rect);
rect.Inflate(1, 1);
g.FillRectangle(brush, rect);
}
RenderButton(g, upButtonRect, upButtonBaseColor, upButtonBorderColor, upButtonArrowColor, ArrowDirection.Left); RenderButton(g, upButtonRect, upButtonBaseColor, upButtonBorderColor, upButtonArrowColor, ArrowDirection.Left);
RenderButton(g, downButtonRect, downButtonBaseColor, downButtonBorderColor, downButtonArrowColor, ArrowDirection.Right); RenderButton(g, downButtonRect, downButtonBaseColor, downButtonBorderColor, downButtonArrowColor, ArrowDirection.Right);

View File

@ -476,8 +476,8 @@ namespace Sunny.UI
float tipsLeft = Width - (ScrollBarVisible ? 50 : 30) - 6 - sfMax; float tipsLeft = Width - (ScrollBarVisible ? 50 : 30) - 6 - sfMax;
float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2; float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2;
e.Graphics.FillEllipse(Brushes.Red, tipsLeft, tipsTop, sfMax, sfMax); e.Graphics.FillEllipse(Color.Red, tipsLeft, tipsTop, sfMax, sfMax);
e.Graphics.DrawString(MenuHelper.GetTipsText(e.Node), TipsFont, Brushes.White, tipsLeft + sfMax / 2.0f - tipsSize.Width / 2.0f, tipsTop + sfMax / 2.0f - tipsSize.Height / 2.0f); e.Graphics.DrawString(MenuHelper.GetTipsText(e.Node), TipsFont, Color.White, tipsLeft + sfMax / 2.0f - tipsSize.Width / 2.0f, tipsTop + sfMax / 2.0f - tipsSize.Height / 2.0f);
} }
} }
} }

View File

@ -795,7 +795,7 @@ namespace Sunny.UI
{ {
if (InMaxBox) if (InMaxBox)
{ {
e.Graphics.FillRoundRectangle(new SolidBrush(btn.FillHoverColor), MaximizeBoxRect, 5); e.Graphics.FillRoundRectangle(btn.FillHoverColor, MaximizeBoxRect, 5);
} }
e.Graphics.DrawFontImage( e.Graphics.DrawFontImage(
@ -808,7 +808,7 @@ namespace Sunny.UI
{ {
if (InMinBox) if (InMinBox)
{ {
e.Graphics.FillRoundRectangle(new SolidBrush(btn.FillHoverColor), MinimizeBoxRect, 5); e.Graphics.FillRoundRectangle(btn.FillHoverColor, MinimizeBoxRect, 5);
} }
e.Graphics.DrawFontImage(62161, 24, Color.White, MinimizeBoxRect, 1); e.Graphics.DrawFontImage(62161, 24, Color.White, MinimizeBoxRect, 1);

View File

@ -1,5 +1,9 @@
+ 增加; - 删除; * 修改 + 增加; - 删除; * 修改
2020.06.16
+ UIBarChart新增ToolTip显示
+ UINavMenu新增TipsText气泡数字显示
2020.06.15 2020.06.15
+UIBarChart新增UIBarChart控件 +UIBarChart新增UIBarChart控件