Commit cf4e27be HZH

步骤控件支持完成图标

1 个父辈 d6a33173
......@@ -24,7 +24,11 @@ namespace HZH_Controls.Controls
public Color StepBackColor
{
get { return m_stepBackColor; }
set { m_stepBackColor = value; }
set
{
m_stepBackColor = value;
Refresh();
}
}
private Color m_stepForeColor = Color.FromArgb(255, 85, 51);
......@@ -35,7 +39,11 @@ namespace HZH_Controls.Controls
public Color StepForeColor
{
get { return m_stepForeColor; }
set { m_stepForeColor = value; }
set
{
m_stepForeColor = value;
Refresh();
}
}
private Color m_stepFontColor = Color.White;
......@@ -46,7 +54,11 @@ namespace HZH_Controls.Controls
public Color StepFontColor
{
get { return m_stepFontColor; }
set { m_stepFontColor = value; }
set
{
m_stepFontColor = value;
Refresh();
}
}
private int m_stepWidth = 35;
......@@ -57,7 +69,11 @@ namespace HZH_Controls.Controls
public int StepWidth
{
get { return m_stepWidth; }
set { m_stepWidth = value; }
set
{
m_stepWidth = value;
Refresh();
}
}
private string[] m_steps = new string[] { "step1", "step2", "step3" };
......@@ -94,6 +110,33 @@ namespace HZH_Controls.Controls
}
}
private int m_lineWidth = 2;
[Description("连接线宽度,最小2"), Category("自定义")]
public int LineWidth
{
get { return m_lineWidth; }
set
{
if (value < 2)
return;
m_lineWidth = value;
Refresh();
}
}
private Image m_imgCompleted = null;
[Description("已完成步骤图片,当不为空时,已完成步骤将不再显示数字"), Category("自定义")]
public Image ImgCompleted
{
get { return m_imgCompleted; }
set
{
m_imgCompleted = value;
Refresh();
}
}
public UCStep()
{
InitializeComponent();
......@@ -148,16 +191,36 @@ namespace HZH_Controls.Controls
{
g.FillEllipse(new SolidBrush(m_stepForeColor), new Rectangle(new Point(intLeft + i * (m_stepWidth + intSplitWidth) + 2, y + 2), new Size(m_stepWidth - 4, m_stepWidth - 4)));
}
if (m_stepIndex > i && m_imgCompleted != null)
{
g.DrawImage(m_imgCompleted, new Rectangle(new Point((intLeft + i * (m_stepWidth + intSplitWidth) + (m_stepWidth - 24) / 2), y + (m_stepWidth - 24) / 2), new Size(24, 24)), 0, 0, m_imgCompleted.Width, m_imgCompleted.Height, GraphicsUnit.Pixel, null);
}
else
{
System.Drawing.SizeF _numSize = g.MeasureString((i + 1).ToString(), this.Font);
g.DrawString((i + 1).ToString(), Font, new SolidBrush(m_stepFontColor), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + (m_stepWidth - (int)_numSize.Width) / 2 + 1, y + (m_stepWidth - (int)_numSize.Height) / 2 + 1));
}
#endregion
System.Drawing.SizeF sizeTxt = g.MeasureString(m_steps[i], this.Font);
g.DrawString(m_steps[i], Font, new SolidBrush(m_stepIndex > i ? m_stepForeColor : m_stepBackColor), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + (m_stepWidth - (int)sizeTxt.Width) / 2 + 1, intTxtY));
}
for (int i = 0; i < m_steps.Length; i++)
{
if (m_stepIndex > i)
{
if (i != m_steps.Length - 1)
{
if (m_stepIndex == i + 1)
{
g.DrawLine(new Pen(m_stepForeColor, 2), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth - 3, y + (m_stepWidth / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth) - intSplitWidth / 2, y + (m_stepWidth / 2)));
g.DrawLine(new Pen(m_stepBackColor, 2), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth + intSplitWidth / 2, y + (m_stepWidth / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth), y + (m_stepWidth / 2)));
g.DrawLine(new Pen(m_stepForeColor, m_lineWidth), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth - 3, y + ((m_stepWidth) / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth) - intSplitWidth / 2, y + ((m_stepWidth) / 2)));
g.DrawLine(new Pen(m_stepBackColor, m_lineWidth), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth + intSplitWidth / 2, y + ((m_stepWidth) / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth) + 3, y + ((m_stepWidth) / 2)));
}
else
{
g.DrawLine(new Pen(m_stepForeColor, 2), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth - 3, y + (m_stepWidth / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth), y + (m_stepWidth / 2)));
g.DrawLine(new Pen(m_stepForeColor, m_lineWidth), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth - 3, y + ((m_stepWidth) / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth) + 3, y + ((m_stepWidth) / 2)));
}
}
}
......@@ -165,16 +228,9 @@ namespace HZH_Controls.Controls
{
if (i != m_steps.Length - 1)
{
g.DrawLine(new Pen(m_stepBackColor, 2), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth - 3, y + (m_stepWidth / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth), y + (m_stepWidth / 2)));
g.DrawLine(new Pen(m_stepBackColor, m_lineWidth), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + m_stepWidth - 3, y + ((m_stepWidth) / 2)), new Point((i + 1) * (m_stepWidth + intSplitWidth) + 3, y + ((m_stepWidth) / 2)));
}
}
System.Drawing.SizeF _numSize = g.MeasureString((i + 1).ToString(), this.Font);
g.DrawString((i + 1).ToString(), Font, new SolidBrush(m_stepFontColor), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + (m_stepWidth - (int)_numSize.Width) / 2 + 1, y + (m_stepWidth - (int)_numSize.Height) / 2 + 1));
#endregion
System.Drawing.SizeF sizeTxt = g.MeasureString(m_steps[i], this.Font);
g.DrawString(m_steps[i], Font, new SolidBrush(m_stepIndex > i ? m_stepForeColor : m_stepBackColor), new Point(intLeft + i * (m_stepWidth + intSplitWidth) + (m_stepWidth - (int)sizeTxt.Width) / 2 + 1, intTxtY));
}
}
......
......@@ -45,7 +45,7 @@
this.ucProcessEllipse1.BackEllipseColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(160)))), ((int)(((byte)(133)))));
this.ucProcessEllipse1.CoreEllipseColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
this.ucProcessEllipse1.IsShowCoreEllipseBorder = true;
this.ucProcessEllipse1.Location = new System.Drawing.Point(78, 117);
this.ucProcessEllipse1.Location = new System.Drawing.Point(90, 288);
this.ucProcessEllipse1.MaxValue = 100;
this.ucProcessEllipse1.Name = "ucProcessEllipse1";
this.ucProcessEllipse1.ShowType = HZH_Controls.Controls.ShowType.Ring;
......@@ -78,20 +78,22 @@
// ucStep1
//
this.ucStep1.BackColor = System.Drawing.Color.Transparent;
this.ucStep1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.ucStep1.LineWidth = 10;
this.ucStep1.Location = new System.Drawing.Point(12, 12);
this.ucStep1.Name = "ucStep1";
this.ucStep1.Size = new System.Drawing.Size(361, 76);
this.ucStep1.Size = new System.Drawing.Size(360, 172);
this.ucStep1.StepBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.ucStep1.StepFontColor = System.Drawing.Color.White;
this.ucStep1.StepForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(85)))), ((int)(((byte)(51)))));
this.ucStep1.StepIndex = 1;
this.ucStep1.StepForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(184)))), ((int)(((byte)(255)))));
this.ucStep1.StepIndex = 2;
this.ucStep1.Steps = new string[] {
"step1",
"step2",
"step3",
"step4",
"step5"};
this.ucStep1.StepWidth = 35;
this.ucStep1.StepWidth = 50;
this.ucStep1.TabIndex = 0;
//
// Form2
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!