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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -