using System; using System.ComponentModel; using System.Drawing.Design; using System.Windows.Forms; using System.Windows.Forms.Design; using Microsoft.VisualBasic; using Microsoft.VisualBasic.CompilerServices; namespace Dongke.IBOSS.PRD.Framework.Controls { [EditorBrowsable(EditorBrowsableState.Never)] public class U_Editor_express : UITypeEditor { public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.Modal; } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { IWindowsFormsEditorService windowsFormsEditorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (windowsFormsEditorService != null && value is string) { TextEdit_Express textEdit_Express = new TextEdit_Express(); textEdit_Express.TextBox1.Text = Conversions.ToString(value); if (windowsFormsEditorService.ShowDialog(textEdit_Express) == DialogResult.OK) { return textEdit_Express.TextBox1.Text; } return value; } } catch (Exception projectError) { ProjectData.SetProjectError(projectError); Interaction.MsgBox("属性编辑器出错", MsgBoxStyle.OkOnly, "提示信息"); object result = value; ProjectData.ClearProjectError(); return result; } return value; } } }