I have a combobox which is populated by the Keys
enumeration (winforms).
The problem is that the key names are not very clear for inexperienced users. For example, the average user may not know what 'OemPipe', or 'HanjaMode' means. So, how can I solve this issue, and have some better key names?
I'm thinking of making a dictionary with the keys and their names, but populating the dictionary myself is very time consuming.
Make a resource file that maps key names to a user-understandable string. If the resource file does not have a value for a particular key, then just go with the Key name (as you are doing now), so that way you only have to define the ones that are difficult to understand, and you don't have to do them all up front.
This also allows you to localize to different languages, if you like.
EDIT: Added code example. Assumption is that you have a resource file named "KeyNames.resx"
foreach (var key in Enum.GetValues(typeof(Keys)))
{
var keyName = KeyNames.ResourceManager.GetString(key.ToString());
if (keyName == null)
keyName = key.ToString();
comboBox1.Items.Add(keyName);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With