public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
edSvc = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService));
if (edSvc != null)
{
// Create a CheckedListBox and populate it with all the enum values
FontListbox = new ListBox
{DrawMode = DrawMode.OwnerDrawFixed, BorderStyle = BorderStyle.None, Sorted = true};
FontListbox.MouseDown += OnMouseDown;
FontListbox.DoubleClick += ValueChanged;
FontListbox.DrawItem += LB_DrawItem;
FontListbox.ItemHeight = 20;
FontListbox.Height = 200;
FontListbox.Width = 180;
ICollection fonts = new FontEnum().EnumFonts();
foreach (string font in fonts)
{
FontListbox.Items.Add(font);
}
edSvc.DropDownControl(FontListbox);
if (FontListbox.SelectedItem != null)
return FontListbox.SelectedItem.ToString();
}
}
return value;
}