2 // System.Drawing.Design.FontEditor.cs
5 // Martin Willemoes Hansen (mwh@sysrq.dk)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
8 // (C) 2003 Martin Willemoes Hansen
9 // (C) 2003 Andreas Nahr
13 using System.ComponentModel;using System.Windows.Forms;
14 namespace System.Drawing.Design
16 public class FontEditor : UITypeEditor
19 private FontDialog fontEdit;
25 public override object EditValue (ITypeDescriptorContext context,
26 IServiceProvider provider, object value)
28 fontEdit = new FontDialog ();
30 fontEdit.Font = (Font) value;
33 fontEdit.Font = new Drawing.Font (FontFamily.GenericSansSerif, 12);
35 fontEdit.FontMustExist = true;
36 DialogResult result = fontEdit.ShowDialog();
38 if (result == DialogResult.OK)
44 public override UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context)
46 return UITypeEditorEditStyle.Modal;