예제 #1
0
 //============================================================
 // <T>加载配置信息。</T>
 //
 // @param xconfig 配置节点
 // @param name 名称
 //============================================================
 public void LoadConfig(FXmlNode xconfig, string name)
 {
     // 加载资源
     if (xconfig.Contains(name + "_rid"))
     {
         _code = xconfig.GetInteger(name + "_rid");
     }
     // 加载对齐
     if (xconfig.Contains(name + "_align_cd"))
     {
         _alignCd = RUiPictureAlign.Parse(xconfig.Get(name + "_align_cd"));
     }
     // 加载位置
     if (xconfig.Contains(name + "_location"))
     {
         _location.Parse(xconfig.Get(name + "_location"));
     }
     // 加载尺寸
     if (xconfig.Contains(name + "_size"))
     {
         _size.Parse(xconfig.Get(name + "_size"));
     }
     // 加载边框
     if (xconfig.Contains(name + "_padding"))
     {
         _padding.Parse(xconfig.Get(name + "_padding"));
     }
 }
예제 #2
0
        ////============================================================
        //// <T>获得或设置资源编号。</T>
        ////============================================================
        //[Category("属性")]
        //[Browsable(true)]
        //[Editor(typeof(FUiResourceEditor), typeof(UITypeEditor))]
        //[DefaultValue("")]
        //[Description("资源编号")]
        //public string ResourceId {
        //   get { return id; }
        //   set {
        //      if (id != value) {
        //         id = value;
        //         // SetupResource(_foreResource);
        //      }
        //   }
        //}

        //============================================================
        // <T>接收尺寸对象。</T>
        //
        // @param size 尺寸对象
        //============================================================
        public void Assign(FRcPicture picture)
        {
            if (picture == null)
            {
                return;
            }
            _code    = picture.Code;
            _alignCd = picture.AlignCd;
            _location.Assign(picture.Location);
            _size.Assign(picture.Size);
            _padding.Assign(picture.Padding);
        }
예제 #3
0
        //============================================================
        // <T>解析字符串内容。</T>
        //
        // @param value 字符串内容
        //============================================================
        public bool Parse(string value)
        {
            // 获得编号
            int index = value.IndexOf(",");

            if (index == -1)
            {
                return(false);
            }
            _code = RInt.Parse(value.Substring(0, index));
            value = value.Substring(index + 1);
            // 获得对齐方式
            index = value.IndexOf(",");
            if (index == -1)
            {
                return(false);
            }
            _alignCd = REnum.ToValue <ERcPictureAlign>(value.Substring(0, index));
            value    = value.Substring(index + 1);
            // 获得位置
            int start = value.IndexOf('(');
            int end   = value.IndexOf(')');

            if ((start == -1) || (end == -1))
            {
                return(false);
            }
            if (!_location.Parse(value.Substring(start + 1, end - start - 1)))
            {
                return(false);
            }
            value = value.Substring(end + 1);
            // 获得空白
            start = value.IndexOf('(');
            end   = value.IndexOf(')');
            if ((start == -1) || (end == -1))
            {
                return(false);
            }
            if (!_padding.Parse(value.Substring(start + 1, end - start - 1)))
            {
                return(false);
            }
            return(true);
        }
예제 #4
0
        //============================================================
        // <T>根据枚举内容获得字符串。</T>
        //
        // @param value 枚举内容
        // @return 字符串
        //============================================================
        public static string ToString(ERcPictureAlign value)
        {
            switch (value)
            {
            case ERcPictureAlign.Left:
                return("left");

            case ERcPictureAlign.LeftTop:
                return("left.top");

            case ERcPictureAlign.Top:
                return("top");

            case ERcPictureAlign.RightTop:
                return("right.top");

            case ERcPictureAlign.Right:
                return("right");

            case ERcPictureAlign.RightBottom:
                return("right.bottom");

            case ERcPictureAlign.Bottom:
                return("bottom");

            case ERcPictureAlign.LeftBottom:
                return("left.bottom");

            case ERcPictureAlign.Center:
                return("center");

            case ERcPictureAlign.Padding:
                return("padding");

            case ERcPictureAlign.Square:
                return("square");
            }
            return("none");
        }