private void BindModifiers(ComboBox cmb) { List <EnumInfo> lstModifiers = EnumUnit.GetEnumInfos(typeof(KeyModifiers)); cmb.Items.Clear(); List <ComboBoxItem> lstValue = new List <ComboBoxItem>(); foreach (EnumInfo info in lstModifiers) { string name = info.FieldName; if (name == "Control") { name = "Ctrl"; } else if (name == "Windows" || name == "All") { continue; } ComboBoxItem item = new ComboBoxItem(name, (int)info.Value); lstValue.Add(item); } cmb.DisplayMember = "FieldName"; cmb.ValueMember = "Value"; cmb.DataSource = lstValue; }
private void BindKeys(ComboBox cmb) { List <EnumInfo> lstKeys = EnumUnit.GetEnumInfos(typeof(Keys)); cmb.Items.Clear(); List <ComboBoxItem> lstValue = new List <ComboBoxItem>(); foreach (EnumInfo info in lstKeys) { int val = (int)info.Value; if (val >= 48 && val <= 120) { string name = info.FieldName; if (name.Length == 2 && name[0] == 'D') { name = name.Substring(1); } ComboBoxItem item = new ComboBoxItem(name, (int)info.Value); lstValue.Add(item); } } cmb.DisplayMember = "FieldName"; cmb.ValueMember = "Value"; cmb.DataSource = lstValue; }
/// <summary> /// 获取皮肤信息 /// </summary> /// <returns></returns> private static Dictionary <int, EnumInfo> GetSkin() { List <EnumInfo> lstInfo = EnumUnit.GetEnumInfos(typeof(DialogSkin)); Dictionary <int, EnumInfo> dic = CommonMethods.ListToDictionary <int, EnumInfo>(lstInfo, "Value"); return(dic); }
/// <summary> /// 初始化缓存类型 /// </summary> private void InitLazyType() { cmbLazy.DisplayMember = "Description"; cmbLazy.ValueMember = "Value"; List <EnumInfo> lst = EnumUnit.GetEnumInfos(typeof(LazyType)); cmbLazy.DataSource = lst; }
/// <summary> /// 填充注释设置 /// </summary> private void FillSummary() { List <EnumInfo> infos = EnumUnit.GetEnumInfos(typeof(SummaryShowItem)); foreach (EnumInfo info in infos) { if (info.FieldName != "All") { ComboBoxItem item = new ComboBoxItem(info.Description, (int)info.Value); clbSummary.Items.Add(item); } } }
private void BindKeys() { List <EnumInfo> lstModifiers = EnumUnit.GetEnumInfos(typeof(KeyModifiers)); cmbModifiers.Items.Clear(); List <ComboBoxItem> lstValue = new List <ComboBoxItem>(); foreach (EnumInfo info in lstModifiers) { string name = info.FieldName; if (name == "Control") { name = "Ctrl"; } else if (name == "Windows" || name == "All") { continue; } ComboBoxItem item = new ComboBoxItem(name, (int)info.Value); lstValue.Add(item); } cmbModifiers.DisplayMember = "FieldName"; cmbModifiers.ValueMember = "Value"; cmbModifiers.DataSource = lstValue; List <EnumInfo> lstKeys = EnumUnit.GetEnumInfos(typeof(Keys)); cmbKeys.Items.Clear(); lstValue = new List <ComboBoxItem>(); foreach (EnumInfo info in lstKeys) { int val = (int)info.Value; if (val >= 48 && val <= 120) { string name = info.FieldName; if (name.Length == 2 && name[0] == 'D') { name = name.Substring(1); } ComboBoxItem item = new ComboBoxItem(name, (int)info.Value); lstValue.Add(item); } } cmbKeys.DisplayMember = "FieldName"; cmbKeys.ValueMember = "Value"; cmbKeys.DataSource = lstValue; }