这样的一个控件 肯定得通过自定义控件来实现了

 public class ProcessLabel : Control
{ public ProcessLabel()
{ //InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); } private int distance = ; public int Distance
{
get { return distance; }
set
{
distance = value;
Invalidate();
}
} private ImageList imagelist = new ImageList(); public ImageList ImageList
{
get { return imagelist; }
set
{
imagelist = value;
Invalidate();
}
} private List<KeyValuePair<string, string>> links = new List<KeyValuePair<string, string>>(); public List<KeyValuePair<string, string>> Links
{
get { return links; }
set
{
links = value;
Invalidate();
}
} protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
Font enFont = new Font("新宋体", , FontStyle.Bold);
Rectangle rect = pe.ClipRectangle;
Graphics g = pe.Graphics;
float x = ;
float y = ;
float x1 = ;
float y1 = ;
float x2 = ;
float y2 = ;
int index = ;
if (Links.Count > )
{
foreach (KeyValuePair<string, string> kv in Links)
{
g.DrawString(kv.Key, enFont, new SolidBrush(Color.DodgerBlue), x, y);
SizeF sf = g.MeasureString(kv.Key, enFont);
x += (sf.Width + distance);
if (imagelist.Images.Count > )
{
Pen blackPenLeft;
Pen blackPenRight;
if (!string.IsNullOrEmpty(kv.Value))
{
x1 = x - distance - sf.Width / - imagelist.Images[].Width / ;
y1 = sf.Height;
g.DrawImage(imagelist.Images[], x1, y1);
blackPenLeft = new Pen(Color.Orange, );
x2 = x1 - ;
y2 = y1 + imagelist.Images[].Height;
g.DrawString(kv.Value, enFont, new SolidBrush(Color.DodgerBlue), x2, y2);
}
else
{
x1 = x - distance - sf.Width / - imagelist.Images[].Width / ;
y1 = sf.Height;
g.DrawImage(imagelist.Images[], x1, y1);
blackPenLeft = new Pen(Color.Black, );
}
if (index + < Links.Count && !string.IsNullOrEmpty(Links[index + ].Value))
{
blackPenRight = new Pen(Color.Orange, );
}
else
{
blackPenRight = new Pen(Color.Black, );
}
if (index == )
{
g.DrawLine(blackPenRight, x1 + imagelist.Images[].Width, y1 + imagelist.Images[].Height / , x1 + imagelist.Images[].Width / + sf.Width / + distance / , y1 + imagelist.Images[].Height / );
}
else if (index == Links.Count - )
{
g.DrawLine(blackPenLeft, x1 - , y1 + imagelist.Images[].Height / , x1 - sf.Width / - distance / , y1 + imagelist.Images[].Height / );
}
else
{
g.DrawLine(blackPenRight, x1 + imagelist.Images[].Width, y1 + imagelist.Images[].Height / , x1 + imagelist.Images[].Width / + sf.Width / + distance / , y1 + imagelist.Images[].Height / );
g.DrawLine(blackPenLeft, x1 - , y1 + imagelist.Images[].Height / , x1 - sf.Width / - distance / , y1 + imagelist.Images[].Height / );
}
index++;
}
}
if (x - distance + < this.Parent.Width)
{
this.Width = this.Parent.Width;
}
else
{
this.Width = Convert.ToInt32(x - distance + );
}
} } }

使用

 ImageList myImageList = new ImageList();
string filePath1 = Application.StartupPath + "\\Images\\orangelink.png";
string filePath2 = Application.StartupPath + "\\Images\\blacklink.png";
myImageList.Images.Add(Image.FromFile(filePath1));
myImageList.Images.Add(Image.FromFile(filePath2));
processLabel1.ImageList = myImageList; List<KeyValuePair<string, string>> source = new List<KeyValuePair<string, string>>();
source.Add(new KeyValuePair<string,string>("下单","08:20"));
source.Add(new KeyValuePair<string,string>("接单","14:20"));
source.Add(new KeyValuePair<string,string>("配送","14:20"));
source.Add(new KeyValuePair<string, string>("收货", "15:20"));
source.Add(new KeyValuePair<string, string>("退货", "17:20"));
source.Add(new KeyValuePair<string, string>("退款", "19:20"));
source.Add(new KeyValuePair<string, string>("完毕", "21:20")); processLabel1.Links = source;

最新文章

  1. jacob操作word
  2. &#39;telnet&#39; 不是内部或外部命令,也不是可运行的程序 或批处理文件。
  3. 我的电脑右下角的日期也不见了只剩下时间,Win7系统,请问是什么原因啊?
  4. it&#39;s hard to say
  5. leetcode 153. Find Minimum in Rotated Sorted Array --------- java
  6. Linux同步机制 - 多线程开发总结
  7. IAR FOR ARM 7.2.2破解方法
  8. ACM算法
  9. laravel memcached使用
  10. mysql导入导出sql文件(包括数据库和数据表的操作)
  11. vue 的准备项目架构环境配置
  12. 使用hue查看hdfs系统报无法访问:/user/hadoop。 Note: you are a Hue admin but not a HDFS superuser, &quot;hdfs&quot; or part of HDFS supergroup, &quot;supergroup&quot;.
  13. Once More
  14. GRE配置教程——华为设备
  15. kubernetes 里面pod时间修改
  16. Laravel编辑产品-CRUD之edit和update
  17. 实例对象与 new 命令
  18. ios中创建自己的框架
  19. Oracle进程中的 LOCAL=NO 和 LOCAL=YES
  20. nginx下基于ThinkPHP框架的网站url重写

热门文章

  1. Codeforce Round #216 Div2
  2. ACM之Java速成(1)
  3. 1020: 部分A+B
  4. mongodb的js操作
  5. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
  6. 静态关键字static
  7. [Ubuntu] Install subversion1.8 on Ubuntu13.10
  8. SSAS中角色(Role)定义需要注意的两个地方
  9. asp.net项目发布网上-当前自定义错误设置禁止远程查看应用程序
  10. 记一个由MemCached引发的性能问题