/// <override></override> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { using (FontFamilyListBox listBox = new FontFamilyListBox(edSvc)) { listBox.BorderStyle = BorderStyle.None; listBox.IntegralHeight = false; listBox.Items.Clear(); int cnt = FontFamily.Families.Length; for (int i = 0; i < cnt; ++i) { FontFamily family = FontFamily.Families[i]; listBox.Items.Add(family.Name); if (family == value) { listBox.SelectedIndex = listBox.Items.Count - 1; } } edSvc.DropDownControl(listBox); if (listBox.SelectedItem != null) { value = listBox.SelectedItem.ToString(); } } } } return(value); }
/// <override></override> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { using (FontFamilyListBox listBox = new FontFamilyListBox(edSvc)) { listBox.BorderStyle = BorderStyle.None; listBox.IntegralHeight = false; listBox.Items.Clear(); FontFamily[] families = FontFamily.Families; int cnt = families.Length; for (int i = 0; i < cnt; ++i) { listBox.Items.Add(families[i].Name); if (families[i] == value) listBox.SelectedIndex = listBox.Items.Count - 1; } edSvc.DropDownControl(listBox); if (listBox.SelectedItem != null) value = listBox.SelectedItem.ToString(); } } } return value; }