Such a control must be implemented by a custom control.
Public classProcesslabel:control { PublicProcesslabel () {//InitializeComponent (); This. SetStyle (Controlstyles.allpaintinginwmpaint | Controlstyles.optimizeddoublebuffer | Controlstyles.resizeredraw | Controlstyles.userpaint,true); } Private intDistance = -; Public intDistance {Get{returndistance;} Set{distance=value; Invalidate (); } } PrivateImageList ImageList =NewImageList (); PublicImageList ImageList {Get{returnImageList;} Set{ImageList=value; Invalidate (); } } Privatelist<keyvaluepair<string,string>> links =Newlist<keyvaluepair<string,string>>(); Publiclist<keyvaluepair<string,string>>Links {Get{returnlinks;} Set{links=value; Invalidate (); } } protected Override voidOnPaint (PaintEventArgs pe) {Base. OnPaint (PE); Font Enfont=NewFont ("New song Body",Ten, FontStyle.Bold); Rectangle rect=PE. ClipRectangle; Graphics g=PE. Graphics; floatx =4; floaty =4; floatX1 =0; floatY1 =0; floatx2 =0; floaty2 =0; intindex =0; if(Links.count >0) { foreach(keyvaluepair<string,string> KVinchLinks) {g.drawstring (kv. Key, Enfont,NewSolidBrush (Color.dodgerblue), x, y); SizeF SF=g.measurestring (KV. Key, Enfont); X+ = (sf. Width +distance); if(ImageList. Images.count >0) {Pen blackpenleft; Pen Blackpenright; if(!string. IsNullOrEmpty (KV. Value) {x1= X-DISTANCE-SF. Width/2-ImageList. images[0]. Width/2; Y1=SF. Height; G.drawimage (ImageList. images[0], x1, y1); Blackpenleft=NewPen (Color.orange,2); X2= x1- A; Y2= y1 + ImageList. images[0]. Height; g.DrawString (KV. Value, Enfont,NewSolidBrush (color.dodgerblue), x2, y2); } Else{x1= X-DISTANCE-SF. Width/2-ImageList. images[1]. Width/2; Y1=SF. Height; G.drawimage (ImageList. images[1], x1, y1); Blackpenleft=NewPen (Color.Black,2); } if(Index +1< Links.count &&!string. IsNullOrEmpty (Links[index +1]. Value) {Blackpenright=NewPen (Color.orange,2); } Else{blackpenright=NewPen (Color.Black,2); } if(Index = =0) {g.drawline (blackpenright, X1+ ImageList. images[0]. Width, y1 + ImageList. images[0]. Height/2, X1 + ImageList. images[0]. Width/2+ SF. Width/2+ Distance/2, Y1 + ImageList. images[0]. Height/2); } Else if(Index = = Links.count-1) {g.drawline (blackpenleft, X1-2, Y1 + ImageList. images[0]. Height/2, X1-SF. Width/2-Distance/2, Y1 + ImageList. images[0]. Height/2); } Else{g.drawline (blackpenright, X1+ ImageList. images[0]. Width, y1 + ImageList. images[0]. Height/2, X1 + ImageList. images[0]. Width/2+ SF. Width/2+ Distance/2, Y1 + ImageList. images[0]. Height/2); G.drawline (Blackpenleft, X1-2, Y1 + ImageList. images[0]. Height/2, X1-SF. Width/2-Distance/2, Y1 + ImageList. images[0]. Height/2); } Index++; } } if(X-distance +4< This. Parent.width) { This. Width = This. Parent.width; } Else { This. Width = Convert.ToInt32 (x-distance +8); } } } }
Use
ImageList myimagelist =NewImageList (); stringFilePath1 = Application.startuppath +"\\Images\\orangelink.png"; stringFilePath2 = 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 =Newlist<keyvaluepair<string,string>>(); Source. ADD (Newkeyvaluepair<string,string> ("Next Order","08:20")); Source. ADD (Newkeyvaluepair<string,string> ("Answer Order","14:20")); Source. ADD (Newkeyvaluepair<string,string> ("Distribution","14:20")); Source. ADD (Newkeyvaluepair<string,string> ("Goods Receipt","15:20")); Source. ADD (Newkeyvaluepair<string,string> ("return","17:20")); Source. ADD (Newkeyvaluepair<string,string> ("Refunds","19:20")); Source. ADD (Newkeyvaluepair<string,string> ("finished","21:20")); Processlabel1.links= Source;
WinForm Custom Controls