Exemplo n.º 1
0
        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns>对象</returns>
        public object Clone()
        {
            BarCodeWrapper bcw = new BarCodeWrapper();

            bcw.Name      = Name;
            bcw.AutoSize  = AutoSize;
            bcw.BackColor = BackColor;
            if (null != BackgroundImage)
            {
                bcw.BackgroundImage = BackgroundImage.Clone() as Image;
            }
            bcw.BackgroundImageLayout = BackgroundImageLayout;
            if (null != Border)
            {
                bcw.Border = Border.Clone() as ElementBorder;
                bcw.Border.OwnerElement = bcw;
            }
            bcw.BorderName = BorderName;
            if (null != ExternDatas)
            {
                bcw.ExternDatas = new List <ExternData>();
                foreach (ExternData ed in ExternDatas)
                {
                    object value = ed.Value;
                    if (null != value && value is ICloneable)
                    {
                        value = ((ICloneable)value).Clone();
                    }
                    bcw.ExternDatas.Add(new ExternData(ed.Key, value));
                }
            }
            if (null != Font)
            {
                bcw.Font = Font.Clone() as Font;
            }
            bcw.HasBorder       = HasBorder;
            bcw.HasBottomBorder = HasBottomBorder;
            bcw.HasLeftBorder   = HasLeftBorder;
            bcw.HasRightBorder  = HasRightBorder;
            bcw.HasTopBorder    = HasTopBorder;
            bcw.Height          = Height;
            bcw.HorizontalScale = HorizontalScale;
            bcw.Location        = Location;
            bcw.MESType         = MESType;
            bcw.MoveX           = MoveX;
            bcw.MoveY           = MoveY;
            bcw.Parent          = Parent;
            bcw.Text            = Text;
            bcw.VerticalScale   = VerticalScale;
            bcw.Width           = Width;
            if (null != SourceField)
            {
                bcw.SourceField = SourceField.Clone();
            }
            bcw.EnableMapping = EnableMapping;
            bcw.MappingTable  = MappingTable;
            bcw.Expression    = Expression;
            bcw.RealText      = RealText;
            bcw.IncludeLabel  = IncludeLabel;
            bcw.BarCodeAlign  = BarCodeAlign;
            bcw.BarCodeType   = BarCodeType;
            bcw.Visible       = Visible;
            bcw.MESType       = MESType;
            if (null != ((IElement)this).ExtendObject)
            {
                ((IElement)bcw).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject;
            }
            return(bcw);
        }
Exemplo n.º 2
0
        public BarCode(IElement element)
            : base()
        {
            BarCodeWrapper bcw = element as BarCodeWrapper;

            Name      = bcw.Name;
            AutoSize  = bcw.AutoSize;
            BackColor = bcw.BackColor;
            if (null != bcw.BackgroundImage)
            {
                BackgroundImage = bcw.BackgroundImage.Clone() as Image;
            }
            BackgroundImageLayout = bcw.BackgroundImageLayout;
            if (null != bcw.Border)
            {
                Border = bcw.Border.Clone() as ElementBorder;
                Border.OwnerElement = this;
            }
            BorderName = bcw.BorderName;
            if (null != bcw.ExternDatas)
            {
                ExternDatas = new List <ExternData>();
                foreach (ExternData ed in bcw.ExternDatas)
                {
                    object value = ed.Value;
                    if (null != value && value is ICloneable)
                    {
                        value = ((ICloneable)value).Clone();
                    }
                    ExternDatas.Add(new ExternData(ed.Key, value));
                }
            }
            if (null != bcw.Font)
            {
                Font = bcw.Font.Clone() as Font;
            }
            HasBorder       = bcw.HasBorder;
            HasBottomBorder = bcw.HasBottomBorder;
            HasLeftBorder   = bcw.HasLeftBorder;
            HasRightBorder  = bcw.HasRightBorder;
            HasTopBorder    = bcw.HasTopBorder;
            Height          = bcw.Height;
            HorizontalScale = bcw.HorizontalScale;
            Location        = bcw.Location;
            MESType         = bcw.MESType;
            MoveX           = bcw.MoveX;
            MoveY           = bcw.MoveY;
            //bcw.Parent = Parent;
            Text          = bcw.Text;
            VerticalScale = bcw.VerticalScale;
            Width         = bcw.Width;
            if (null != bcw.SourceField)
            {
                SourceField = bcw.SourceField.Clone();
            }
            EnableMapping = bcw.EnableMapping;
            MappingTable  = bcw.MappingTable;
            Expression    = bcw.Expression;
            RealText      = bcw.RealText;
            IncludeLabel  = bcw.IncludeLabel;
            BarCodeAlign  = bcw.BarCodeAlign;
            BarCodeType   = bcw.BarCodeType;
            Visible       = bcw.Visible;
            MESType       = bcw.MESType;
            if (null != ((IElement)bcw).ExtendObject)
            {
                ((IElement)this).ExtendObject = ((IElement)bcw).ExtendObject.Clone() as ExtendObject;
            }
        }