private void BorderAction() { BorderEditorDialog editor = new BorderEditorDialog(Border); if (DialogResult.OK == editor.ShowDialog()) { if (null != Border && !Border.Equals(editor.Border)) { Border = editor.Border; editor.Border.OwnerElement = this as IElement; this.BorderName = editor.Border.Name; ExternData data = new ExternData("BorderName", editor.Border.Name); int index = -1; if (null != this.ExternDatas) { for (int i = 0; i < this.ExternDatas.Count; i++) { if (data.Equals(this.ExternDatas[i])) { this.ExternDatas[i] = data; index = i; break; } } if (index == -1) { this.ExternDatas.Add(data); } } NotifyDesignSurfaceChange(); } } }
private int ChecExistkExternDatas(IList <ExternData> list, ExternData ed) { if (null != list) { for (int i = 0; i < list.Count; i++) { if (ed.Equals(list[i])) { return(i); } } } return(-1); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (null != context && null != context.Instance && null != context.Container) { if (null != context.Instance) { IElement element = context.Instance as IElement; if (null != element) { ElementBorder border = value as ElementBorder; BorderEditorDialog editor = new BorderEditorDialog(border); if (DialogResult.OK == editor.ShowDialog()) { if (null != border && border.Equals(editor.Border)) { return(editor.Border); } editor.Border.OwnerElement = context.Instance as IElement; element.BorderName = editor.Border.Name; ExternData data = new ExternData("BorderName", editor.Border.Name); int index = -1; if (null != element.ExternDatas) { for (int i = 0; i < element.ExternDatas.Count; i++) { if (data.Equals(element.ExternDatas[i])) { element.ExternDatas[i] = data; index = i; break; } } if (index == -1) { element.ExternDatas.Add(data); } } return(editor.Border); } } } } return(base.EditValue(context, provider, value)); }