c# - How to set default values for the properties of a derived control? -



c# - How to set default values for the properties of a derived control? -

i derived toolstripcombobox in order create 1 encapsulates percentage picking dropdown. goal have of validation , string parsing in derived control. parent receives event when percentage chosen has changed, , can access public integer getting , setting percentage.

the problem have in designer file parent command place derived command on, keeps adding total set of strings using combobox.items.addrange method. in constructor derived command have following:

foreach (int in percentages) { combobox.items.add(string.format("{0}%", i)); }

over time these values accumulate in designer file many, many times over. don't know how create items property hidden since it's not virtual. want suppress flooding of designer file.

example of designer file:

this.zoom_cbo.items.addrange(new object[] { "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%", "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%", "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%", "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%", "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%", "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%", "10%", "25%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "600%", "800%", "1600%"});

since it's derived list user selecting from, seek adding derived combo box prevent serialization of items:

[browsable(false)] [designerserializationvisibility(designerserializationvisibility.hidden)] public new objectcollection items { { homecoming ((combobox)this).items; } }

c# winforms inheritance control default-value

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -