public MyPaddingForm(MyPadding padding) { InitializeComponent(); _padding = padding; this.txtHeight.Text = _padding.Hight.ToString(); this.txtWidth.Text = _padding.Width.ToString(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService editService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editService != null) { if (this._padForm == null) { _padForm = new MyPaddingForm(value as MyPadding); _padForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; } else { this._padForm.MyPadding = value as MyPadding; this._padForm.SetTexts(); } if (editService.ShowDialog(_padForm) == System.Windows.Forms.DialogResult.OK) { MyPadding newMyPadding = new MyPadding(_padForm.MyPadding.Hight, _padForm.MyPadding.Width); value = (object)newMyPadding; } } } return value; }
/// <summary> /// Static constructor initialize the static Field. /// </summary> static MyPadding() { Empty = new MyPadding(0, 0); }