public ThingEditorForm(GraphicThing graphicThing) { this.graphicThing = graphicThing; //jj // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // }
public ThingEditorCtrl(GraphicThing graphicThing) { this.graphicThing = graphicThing; InitContextMenu(); colorNormalSegment = Color.FromArgb(220, 220, 255); backgrndColor = Color.FromArgb(170, 170, 200); gridColor = Color.Black; textAreaContourColor = Color.FromArgb(100, 180, 180, 100); mainContourColor = Color.FromArgb(100, 220, 220, 255); dragging = false; flagShowPoints = true; flagShowGrid = true; flagDefineTextArea = false; distanceToLine = 10; distanceToTextArea = 10; decorationWidth = 100; gridSize = 16; saveGridSize = gridSize; gridStyle = EGridStyle.GrdLine; vScrollBar = null; hScrollBar = null; if (graphicThing != null) { outLines = new ArrayList(); if (graphicThing.Elements.Count > 0) { Contour elements = new Contour(graphicThing.FrameColor, graphicThing.Elements); outLines.Add(elements); elements.Changed += new OutlineChangeEventHandler(onContourChanged); } else { outLines = new ArrayList(); Contour contour = new Contour(mainContourColor, gridSize); outLines.Add(contour); contour.Changed += new OutlineChangeEventHandler(onContourChanged); } if (graphicThing.Decorations.Count > 0) { PolyLine polyLine = null; foreach (Element element in graphicThing.Decorations) { if (element is Line) { if (polyLine == null) { polyLine = new PolyLine(element as Line); } else { if (!polyLine.Add(element as Line)) // couldn't add because ends don't connect, start a new one. { outLines.Add(polyLine); polyLine.Changed += new OutlineChangeEventHandler(onContourChanged); polyLine = new PolyLine(element as Line); } } } } if (polyLine != null) { outLines.Add(polyLine); polyLine.Changed += new OutlineChangeEventHandler(onContourChanged); } } if (graphicThing.TextArea.Count > 0) { Contour textArea = new Contour(graphicThing.FrameColor, graphicThing.TextArea); outLines.Add(textArea); textArea.Changed += new OutlineChangeEventHandler(onContourChanged); } } RectangleF tempRect = getBoundingRect(); MinX = tempRect.Left; MinY = tempRect.Top; MaxX = tempRect.Right; MaxY = tempRect.Bottom; onShapeChanged(this, null); }