winforms - c# draw linklabel on usercontrol -



winforms - c# draw linklabel on usercontrol -

i'm designing usercontrol hold list of linklabels. this:

public class itemcontrol : linklabel {} public class itemscontrol : usercontrol { private readonly list<itemcontrol> items; public taskbox() { this.items = new list<itemcontrol>(); } public list<itemcontrol> items { { homecoming this.items; } } }

but how can draw items on usercontrol 1 time add together them list? how can add together clicked event them in code?

you can set flowlayoutpanel command on itemscontrol , utilize next code draw itemcontrols it:

foreach (var item in this.items) { flowlayoutpanel1.controls.add(item); item.linkclicked += item_linkclicked; } void item_linkclicked(object sender, linklabellinkclickedeventargs e) { messagebox.show(((item)sender).name); }

using flowlayaoutpanel arbitrary, if don't utilize flowlayoutpanel, can set each linkitem straight on usercontrol, , have manage each linkitem location, yourself.

c# winforms user-controls

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -