Beispiel #1
0
        public IControlTranslator ToElement(bool transferChild)
        {
            PmsLabelWrapper label = new PmsLabelWrapper();

            label.BackColor  = this.BackColor;
            label.StrFormate = StrFormate;
            label.BorderName = this.BorderName;
            if (null != ExternDatas && ExternDatas.Count > 0)
            {
                if (null == label.ExternDatas)
                {
                    label.ExternDatas = new List <ExternData>();
                }
                foreach (ExternData ed in this.ExternDatas)
                {
                    label.ExternDatas.Add(ed);
                }
            }
            if (null != this.Border)
            {
                label.Border = Border.Clone() as ElementBorder;
                label.Border.OwnerElement = label;
            }
            label.Text            = Text;
            label.ForeColor       = this.ForeColor;
            label.HasBottomBorder = this.HasBottomBorder;
            label.HasLeftBorder   = this.HasLeftBorder;
            label.HasRightBorder  = this.HasRightBorder;
            label.HasTopBorder    = this.HasTopBorder;
            label.HasBorder       = HasBorder;
            label.Visible         = Visible;
            label.MESType         = MESType;
            if (_orginalHeight > 0)
            {
                label.Height = this._orginalHeight;
            }
            else
            {
                label.Height = this.Height;
            }
            if (_orginalWidth > 0)
            {
                label.Width = _orginalWidth;
            }
            else
            {
                label.Width = this.Width;
            }
            //label.VerticalScale = this.VerticalScale;
            //label.HorizontalScale = this.HorizontalScale;
            if (_orginalLocation != Point.Empty)
            {
                label.Location = this._orginalLocation;
            }
            else
            {
                label.Location = this.Location;
            }
            label.VerticalScale   = 1f;
            label.HorizontalScale = 1f;
            label.MoveX           = this.MoveX;
            label.MoveY           = this.MoveY;
            label.Name            = this.Name;
            label.TextAlign       = this.TextAlign;
            label.Expression      = Expression;
            label.EnableMapping   = EnableMapping;
            label.MappingTable    = MappingTable;
            if (_orginalFontSize > 0)
            {
                label.Font = new Font(Font.FontFamily, _orginalFontSize);
            }
            else
            {
                label.Font = new Font(this.Font.FontFamily, this.Font.Size);
            }

            if (EnableMapping)
            {
                label.EnableMapping = false;
                if (!string.IsNullOrEmpty(RealText))
                {
                    label.RealText = GetMapValue(RealText);
                }
            }

            if (null != ((IElement)this).ExtendObject)
            {
                ((IElement)label).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject;
            }

            label.RealText = RealText;
            return(label);
        }
Beispiel #2
0
        public PmsLabel(IElement element)
            : base()
        {
            PmsLabelWrapper label = element as PmsLabelWrapper;

            BackColor  = label.BackColor;
            StrFormate = label.StrFormate;
            BorderName = label.BorderName;
            if (null != label.ExternDatas && label.ExternDatas.Count > 0)
            {
                if (null == ExternDatas)
                {
                    ExternDatas = new List <ExternData>();
                }
                foreach (ExternData ed in label.ExternDatas)
                {
                    object value = ed.Value;
                    if (null != value && value is ICloneable)
                    {
                        value = ((ICloneable)value).Clone();
                    }
                    ExternDatas.Add(new ExternData(ed.Key, value));
                }
            }
            if (null != this.Border)
            {
                Border = label.Border.Clone() as ElementBorder;
                Border.OwnerElement = this;
            }
            ForeColor       = label.ForeColor;
            HasBottomBorder = label.HasBottomBorder;
            HasLeftBorder   = label.HasLeftBorder;
            HasRightBorder  = label.HasRightBorder;
            HasTopBorder    = label.HasTopBorder;
            HasBorder       = label.HasBorder;
            Height          = label.Height;
            Width           = label.Width;
            VerticalScale   = label.VerticalScale;
            HorizontalScale = label.HorizontalScale;
            Location        = label.Location;
            HasBorder       = label.HasBorder;
            Text            = label.Text;
            RealText        = label.RealText;
            if (null != label.SourceField)
            {
                SourceField = label.SourceField.Clone() as SourceField;
            }
            MoveX         = label.MoveX;
            MoveY         = label.MoveY;
            Name          = label.Name;
            TextAlign     = label.TextAlign;
            Expression    = label.Expression;
            EnableMapping = label.EnableMapping;
            MappingTable  = label.MappingTable;
            Font          = new Font(label.Font.FontFamily, label.Font.Size, label.Font.Style);
            Visible       = label.Visible;
            MESType       = label.MESType;
            if (null != ((IElement)label).ExtendObject)
            {
                ((IElement)this).ExtendObject = ((IElement)label).ExtendObject.Clone() as ExtendObject;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns>对象</returns>
        public object Clone()
        {
            PmsLabelWrapper label = new PmsLabelWrapper();

            label.BackColor  = this.BackColor;
            label.StrFormate = StrFormate;
            label.BorderName = this.BorderName;
            if (null != ExternDatas && ExternDatas.Count > 0)
            {
                if (null == label.ExternDatas)
                {
                    label.ExternDatas = new List <ExternData>();
                }
                foreach (ExternData ed in this.ExternDatas)
                {
                    object value = ed.Value;
                    if (null != value && value is ICloneable)
                    {
                        value = ((ICloneable)value).Clone();
                    }
                    label.ExternDatas.Add(new ExternData(ed.Key, value));
                }
            }
            if (null != this.Border)
            {
                label.Border = Border.Clone() as ElementBorder;
                label.Border.OwnerElement = label;
            }
            label.ForeColor       = this.ForeColor;
            label.HasBottomBorder = this.HasBottomBorder;
            label.HasLeftBorder   = this.HasLeftBorder;
            label.HasRightBorder  = this.HasRightBorder;
            label.HasTopBorder    = this.HasTopBorder;
            label.Height          = this.Height;
            label.Width           = this.Width;
            label.VerticalScale   = this.VerticalScale;
            label.HorizontalScale = this.HorizontalScale;
            label.Location        = this.Location;
            label.HasBorder       = this.HasBorder;
            label.RealText        = this.RealText;
            label.Text            = this.Text;
            label.Visible         = Visible;
            if (null != this.SourceField)
            {
                label.SourceField = this.SourceField.Clone() as SourceField;
            }
            if (null != Font)
            {
                label.Font = new Font(this.Font.FontFamily, this.Font.Size, this.Font.Style);
            }
            label.MoveX         = this.MoveX;
            label.MoveY         = this.MoveY;
            label.Name          = this.Name;
            label.TextAlign     = this.TextAlign;
            label.Expression    = Expression;
            label.EnableMapping = EnableMapping;
            label.MappingTable  = MappingTable;
            label.MESType       = MESType;
            if (null != ((IElement)this).ExtendObject)
            {
                ((IElement)label).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject;
            }
            return(label);
        }