Exemple #1
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            FontDialog     dlg = new FontDialog();
            PersistentFont src = (PersistentFont)value;

            dlg.ShowColor = true;
            dlg.Font      = (Font)src.GdiFont.Clone();
            dlg.Color     = src.FontColor;
            if (dlg.ShowDialogEx() == DialogResult.OK)
            {
                return(PersistentFont.FromFont(dlg.Font, dlg.Color));
            }
            else
            {
                return(value);
            }
        }