public IControlTranslator ToElement(bool transferChild) { PmsFlowLayoutWrapper layout = new PmsFlowLayoutWrapper(); layout.Name = Name; layout.AutoSize = AutoSize; layout.BackColor = BackColor; if (null != BackgroundImage) { layout.BackgroundImage = BackgroundImage.Clone() as Image; } layout.BackgroundImageLayout = BackgroundImageLayout; if (null != Border) { layout.Border = Border.Clone() as ElementBorder; } layout.BorderName = BorderName; if (null != ExternDatas) { layout.ExternDatas = new List <ExternData>(); foreach (ExternData ed in ExternDatas) { object value = ed.Value; if (null != value && value is ICloneable) { value = ((ICloneable)value).Clone(); } layout.ExternDatas.Add(new ExternData(ed.Key, value)); } } layout.ObjectPadding = this.ObjectPadding; layout.RowPadding = this.RowPadding; layout.IsVerticalLayout = IsVerticalLayout; if (_orginalFontSize > 0) { layout.Font = new Font(Font.FontFamily, _orginalFontSize); } else { layout.Font = new Font(this.Font.FontFamily, this.Font.Size); } layout.VerticalScale = 1f; layout.HorizontalScale = 1f; layout.HasBorder = HasBorder; layout.HasBottomBorder = HasBottomBorder; layout.HasLeftBorder = HasLeftBorder; layout.HasRightBorder = HasRightBorder; layout.HasTopBorder = HasTopBorder; layout.Location = Location; layout.MESType = MESType; layout.MoveX = MoveX; layout.MoveY = MoveY; layout.Text = Text; layout.Visible = Visible; layout.MESType = MESType; if (_orginalHeight > 0) { layout.Height = this._orginalHeight; } else { layout.Height = this.Height; } if (_orginalWidth > 0) { layout.Width = _orginalWidth; } else { layout.Width = this.Width; } //layout.VerticalScale = this.VerticalScale; //layout.HorizontalScale = this.HorizontalScale; if (_orginalLocation != Point.Empty) { layout.Location = this._orginalLocation; } else { layout.Location = this.Location; } layout.MESMargin = new Padding(MESMargin.Left, MESMargin.Top, MESMargin.Right, MESMargin.Bottom); if (null != ((IElement)this).ExtendObject) { ((IElement)layout).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject; } return(layout); }
public object Clone() { PmsFlowLayoutWrapper layout = new PmsFlowLayoutWrapper(); layout.Name = Name; layout.AutoSize = AutoSize; layout.BackColor = BackColor; if (null != BackgroundImage) { layout.BackgroundImage = BackgroundImage.Clone() as Image; } layout.BackgroundImageLayout = BackgroundImageLayout; if (null != Border) { layout.Border = Border.Clone() as ElementBorder; layout.Border.OwnerElement = layout; } layout.BorderName = BorderName; if (null != ExternDatas) { layout.ExternDatas = new List <ExternData>(); foreach (ExternData ed in ExternDatas) { object value = ed.Value; if (null != value && value is ICloneable) { value = ((ICloneable)value).Clone(); } layout.ExternDatas.Add(new ExternData(ed.Key, value)); } } if (null != Font) { layout.Font = Font.Clone() as Font; } layout.ObjectPadding = this.ObjectPadding; layout.RowPadding = this.RowPadding; layout.HasBorder = HasBorder; layout.HasBottomBorder = HasBottomBorder; layout.HasLeftBorder = HasLeftBorder; layout.HasRightBorder = HasRightBorder; layout.HasTopBorder = HasTopBorder; layout.Height = Height; layout.HorizontalScale = HorizontalScale; layout.Location = Location; layout.MESType = MESType; layout.MoveX = MoveX; layout.MoveY = MoveY; layout.Parent = Parent; layout.Text = Text; layout.VerticalScale = VerticalScale; layout.Width = Width; layout.IsVerticalLayout = this.IsVerticalLayout; layout.MESMargin = new Padding(MESMargin.Left, MESMargin.Top, MESMargin.Right, MESMargin.Bottom); layout.Visible = Visible; layout.MESType = MESType; if (null != ((IElement)this).ExtendObject) { ((IElement)layout).ExtendObject = ((IElement)this).ExtendObject.Clone() as ExtendObject; } return(layout); }
public PmsFlowLayout(IElement element) { this.MinimumSize = new Size(110, 16); this.MaximumSize = this.MinimumSize; PmsFlowLayoutWrapper layout = element as PmsFlowLayoutWrapper; Name = layout.Name; AutoSize = layout.AutoSize; BackColor = layout.BackColor; if (null != layout.BackgroundImage) { BackgroundImage = layout.BackgroundImage.Clone() as Image; } BackgroundImageLayout = layout.BackgroundImageLayout; if (null != layout.Border) { Border = layout.Border.Clone() as ElementBorder; Border.OwnerElement = this; } BorderName = layout.BorderName; if (null != layout.ExternDatas) { ExternDatas = new List <ExternData>(); foreach (ExternData ed in layout.ExternDatas) { object value = ed.Value; if (null != value && value is ICloneable) { value = ((ICloneable)value).Clone(); } ExternDatas.Add(new ExternData(ed.Key, value)); } } if (null != layout.Font) { Font = layout.Font.Clone() as Font; } ObjectPadding = layout.ObjectPadding; RowPadding = layout.RowPadding; IsVerticalLayout = layout.IsVerticalLayout; HasBorder = layout.HasBorder; HasBottomBorder = layout.HasBottomBorder; HasLeftBorder = layout.HasLeftBorder; HasRightBorder = layout.HasRightBorder; HasTopBorder = layout.HasTopBorder; Height = layout.Height; HorizontalScale = layout.HorizontalScale; Location = layout.Location; MESType = layout.MESType; MoveX = layout.MoveX; MoveY = layout.MoveY; //layout.Parent = Parent; Text = layout.Text; VerticalScale = layout.VerticalScale; Width = layout.Width; MESMargin = new Padding(layout.MESMargin.Left, layout.MESMargin.Top, layout.MESMargin.Right, layout.MESMargin.Bottom); Visible = layout.Visible; MESType = layout.MESType; if (null != ((IElement)layout).ExtendObject) { ((IElement)this).ExtendObject = ((IElement)layout).ExtendObject.Clone() as ExtendObject; } }