public static string Show(IWin32Window owner, string formatString) { using (var dlg = new FormatEditorForm()) { dlg.m_ctlBuilderEditor.Text = formatString; return(dlg.ShowDialog(owner) == DialogResult.OK ? dlg.m_ctlBuilderEditor.Text.Trim() : null); } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { //Control owner = ((System.Windows.Forms.PropertyGridInternal.GridEntry)context).OwnerGrid.Parent; var owner = (IWin32Window)context.GetReflectedValue("OwnerGrid").GetReflectedValue("Parent"); string cs = FormatEditorForm.Show(owner, value.ToString()); return(string.IsNullOrWhiteSpace(cs) ? value : cs); }