public FormTextProperties(ShapeText shapeText) { InitializeComponent(); txtContents.Text = shapeText.Text; refShape = shapeText; txtChanged = false; fontChanged = false; txtContents.Font = refShape.Font; FD.Font = refShape.Font; switch (refShape.Alignment) { case StringAlignment.Near: txtContents.TextAlign = HorizontalAlignment.Left; break; case StringAlignment.Center: txtContents.TextAlign = HorizontalAlignment.Center; break; case StringAlignment.Far: txtContents.TextAlign = HorizontalAlignment.Right; break; } }
public override Shape Clone() { ShapeText newShape = new ShapeText(); newShape.Text = this.text; newShape.Location = new Point(this.Location.X + 15, this.Location.Y + 15); newShape.Size = this.Size; newShape.Font = (Font)this.font.Clone(); newShape.painter.CopyProperties(ref this.painter); newShape.isInitializing = false; if (painter.ColorCount > 1 || painter.PaintBorder) { newShape.GeneratePath(); } this.isSelected = false; return(newShape); }
public void AddShape(byte intShapeID) { switch (intShapeID) { case 0: //Rectangle ShapeRectangle rect = new ShapeRectangle(); rect.Location = new Point(50, 50); AddShape(rect); break; case 1: //Triangle ShapeTriangle triangle = new ShapeTriangle(); triangle.Location = new Point(50, 50); AddShape(triangle); break; case 2: ShapeCircle circle = new ShapeCircle(); circle.Location = new Point(50, 50); AddShape(circle); break; case 3: ShapePolygon poly = new ShapePolygon(); poly.Location = new Point(50, 50); AddShape(poly); break; case 4: ShapeLine line = new ShapeLine(); line.Location = new Point(50, 50); AddShape(line); break; case 5: ShapeText text = new ShapeText(); text.Location = new Point(50, 50); AddShape(text); break; default: throw new Exception("Could not find the associated shape type!"); } }
public override Shape Clone() { ShapeText newShape = new ShapeText(); newShape.Text = this.text; newShape.Location = new Point(this.Location.X + 15, this.Location.Y + 15); newShape.Size = this.Size; newShape.Font = (Font)this.font.Clone(); newShape.painter.CopyProperties(ref this.painter); newShape.isInitializing = false; if (painter.ColorCount > 1 || painter.PaintBorder) newShape.GeneratePath(); this.isSelected = false; return newShape; }