public DialogResult Show(Anchor anchor) { if(anchor == null) btnCancel_Click(this, EventArgs.Empty); tmpAnchor = anchor; tempTop = tmpAnchor.TopAnchor; chkBoxTop.Checked = tempTop; tempLeft = tmpAnchor.LeftAnchor; chkBoxLeft.Checked = tempLeft; tempRight = tmpAnchor.RightAnchor; chkBoxRight.Checked = tempRight; tempBottom = tmpAnchor.Bottomanchor; chkBoxBottom.Checked = tempBottom; return this.ShowDialog(); }
public EditorItem() { anchor = new Anchor(this); this.Name = MakeName(); }
/// <summary> /// How this item is loaded /// </summary> /// <param name="node"></param> public virtual void Load(System.Xml.XmlNode element) { UnitsManager unitMng = new UnitsManager(); // load name XmlAttribute attr = (XmlAttribute)element.Attributes.GetNamedItem("Name"); if (attr != null) { this.Name = attr.Value; } // Load location if available XmlNode locationNode = element.SelectSingleNode("Location"); if (locationNode != null) { this.MeasureUnit = unitMng.StringToUnit(locationNode.Attributes["PositionX"].Value); this.LocationInUnitsX = (float)(System.Convert.ToDouble(locationNode.Attributes["PositionX"].Value.TrimEnd(unitMng.UnitToString(MeasureUnit).ToCharArray()))); this.LocationInUnitsY = (float)(System.Convert.ToDouble(locationNode.Attributes["PositionY"].Value.TrimEnd(unitMng.UnitToString(MeasureUnit).ToCharArray()))); } // Load dimensions and shape definition XmlNode shapeNode = element.SelectSingleNode("Shape"); if (shapeNode != null) { string shapeType = shapeNode.Attributes["Type"].Value; if (shapeType == "Rectangle") { // load width and height XmlNode dimensionNode = shapeNode.SelectSingleNode("Dimensions"); if (dimensionNode != null) { this.WidthInUnits = (float)(System.Convert.ToDouble(dimensionNode.Attributes["Width"].Value.TrimEnd(unitMng.UnitToString(MeasureUnit).ToCharArray()))); this.HeightInUnits = (float)(System.Convert.ToDouble(dimensionNode.Attributes["Height"].Value.TrimEnd(unitMng.UnitToString(MeasureUnit).ToCharArray()))); } } } // Load scale XmlNode scaleNode = element.SelectSingleNode("Scale"); if (scaleNode != null) { MeasureUnits mUnit = unitMng.StringToUnit(scaleNode.Attributes["x"].Value); this.ScaleXFactor = (float)(System.Convert.ToDouble(scaleNode.Attributes["x"].Value.TrimEnd(unitMng.UnitToString(mUnit).ToCharArray()))); this.ScaleYFactor = (float)(System.Convert.ToDouble(scaleNode.Attributes["y"].Value.TrimEnd(unitMng.UnitToString(mUnit).ToCharArray()))); } // Load Transformation XmlNode transNode = element.SelectSingleNode("Transformation"); if (transNode != null) { TransformationMatrix.Elements[0] = (float)System.Convert.ToDouble(transNode.Attributes["a"].Value); TransformationMatrix.Elements[1] = (float)System.Convert.ToDouble(transNode.Attributes["b"].Value); TransformationMatrix.Elements[2] = (float)System.Convert.ToDouble(transNode.Attributes["c"].Value); TransformationMatrix.Elements[3] = (float)System.Convert.ToDouble(transNode.Attributes["d"].Value); } // Load Rotation XmlNode rotationNode = element.SelectSingleNode("Rotation"); if(rotationNode != null) { this.RotationAngle = Convert.ToInt16(rotationNode.Attributes[0].Value); } // load width in pixels and height in pixels as editor works with those XmlNode widthInPixelsNode = element.SelectSingleNode("WidthInPixels"); if (widthInPixelsNode != null) { this.WidthInPixels = (float) Convert.ToDouble(widthInPixelsNode.Attributes[0].Value); } XmlNode heightInPixelsNode = element.SelectSingleNode("HeightInPixels"); if (heightInPixelsNode != null) { this.HeightInPixels = (float) Convert.ToDouble(heightInPixelsNode.Attributes[0].Value); } // Load dock position XmlNode dockPos = element.SelectSingleNode("DockPosition"); if (dockPos != null) { this.DockPositionString = dockPos.Attributes["Dock"].Value; } // load anchor property XmlNode anchorNode = element.SelectSingleNode("Anchor"); if(anchorNode != null) { if(this.anchor == null) this.anchor = new Anchor(this); this.ItemAnchor.TopAnchor = Convert.ToBoolean(anchorNode.Attributes["Top"].Value); this.ItemAnchor.Bottomanchor = Convert.ToBoolean(anchorNode.Attributes["Bottom"].Value); this.ItemAnchor.LeftAnchor = Convert.ToBoolean(anchorNode.Attributes["Left"].Value); this.ItemAnchor.RightAnchor = Convert.ToBoolean(anchorNode.Attributes["Right"].Value); } this.commands.Clear(); if(this is EditorProject || this is ReportPage) { } else { EditorItemFactory.Instance.CreateItem(this); } }