/// <summary> /// 创建一个类的属性 /// </summary> /// <param name="Title">属性名称</param> /// <returns>是否成功创建</returns> public bool CreatePicXAribute(string Title) { foreach (XAribute xb in ListXAributes) { if (xb.Title == Title) { return(false); } } XAribute bute = new XAribute(1, Title, XAribute.XAttributeType.XBool, XAribute.XAttributeSpec.XNone, XAribute.XPositonStyle.Left, this.ChileEventCallBack, XAribute.CanLinkType.One, "bool"); ///将类设置为属性的父控件 bute.ParentControl = this; ///当ExName改变的时候 bute.ExNameChange = (s, o, v) => { ///修改ExName ModifyPropetyExName((s as XAribute).Title, v); }; ///绑定标题改变事件 bute.TitleChange += (e, o, v) => { ///修改Title return(ModifyPropertyTitle(o, v)); }; ListXAributes.Add(bute); ///回调 if (MessageUpdateCall != null) { MessageUpdateCall(bute, MouseState.XUpdatePropertyData); } return(true); }
/// <summary> /// 从文件加载一个属性 /// </summary> /// <param name="xt">属性类型</param> /// <param name="xs">属性的集合类型</param> /// <param name="xp">复制匡的位置是在左边还是右边</param> /// <param name="paramterName">属性名称</param> /// <param name="clt">连接方式</param> /// <param name="tiptext">提示信息</param> /// <param name="LastExName">属性类型</param> /// <param name="id">属性框ID</param> /// <param name="opentype">公开类型</param> public XAribute LoadXAribute(XAribute.XAttributeType xt, XAribute.XAttributeSpec xs, XAribute.XPositonStyle xp, string paramterName, XAribute.CanLinkType clt, string tiptext, string LastExName, int id, OpenType opentype) { XAribute xb = new XAribute(id, paramterName, xt, xs, xp, this.ChileEventCallBack, clt, LastExName); xb.Hint = tiptext; xb.MyOpenType = opentype; ///绑定标题改变事件 xb.TitleChange += (e, o, v) => { ///修改Title return(ModifyPropertyTitle(o, v)); }; xb.ExNameChange += (s, o, v) => { ///修改ExName this.ModifyPropetyExName((s as XAribute).Title, v); }; ///检测是否存在 if (!ListXAributes.Contains(xb)) { ListXAributes.Add(xb); return(xb); } return(null); }