c# - How can I add a combobox in control designer properties for a WinForms custom control? -


i'm creating custom control property can take value set of strings "man, woman". in in control designer properties want show combobox these 2 choices.

is there standard way ? if not should implement ?

the simple way add enum code defines possible choices property, configure custom control's property accept value of type. properties window automatically display combo box property of possible values in enum listed.

so, example:

public enum gender {     man,     woman, }  public class mycustomcontrol : usercontrol {     public gender usergender { get; set; } } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -