/// <summary> /// Paints the shape on the canvas /// </summary> /// <param name="g"></param> public override void Paint(System.Drawing.Graphics g) { RectangleF r = Rectangle; g.DrawRectangle(new Pen(Color.Black, IsSelected ? 2F : 1F), r.Left, r.Top, r.Width, r.Height); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; g.FillRectangle(new SolidBrush(ShapeColor), r.X, r.Y, r.Width, 12); Color Background = IsSelected ? Color.LightSteelBlue : Color.WhiteSmoke; g.FillRectangle(new SolidBrush(Background), r.X, r.Y + 12, r.Width, r.Height - 12); g.DrawString(OperatorType.ToString() + " (" + outputType.ToString() + ")", Font, new SolidBrush(this.TextColor), r.Left + (r.Width / 2), r.Top, sf); sf.Alignment = StringAlignment.Far; g.DrawString("Output", Font, new SolidBrush(Color.Black), r.Right - 2, r.Top + 2 * (r.Height / 3) - 7, sf); }
/// <summary> /// Paints the shape on the canvas /// </summary> /// <param name="g"></param> public override void Paint(System.Drawing.Graphics g) { StringFormat sf = new StringFormat(); SizeF ss = g.MeasureString("Random", Font); //the title part g.FillRectangle(new SolidBrush(ShapeColor), Rectangle.X, Rectangle.Y, Rectangle.Width, 12); sf.Alignment = StringAlignment.Center; g.DrawString("Random", Font, new SolidBrush(Color.Black), Rectangle.Left + (Rectangle.Width / 2), Rectangle.Top, sf); //the data part Color Background = IsSelected ? Color.LightSteelBlue : Color.WhiteSmoke; g.FillRectangle(new SolidBrush(Background), Rectangle.X, Rectangle.Y + 12, Rectangle.Width, Rectangle.Height - 12); sf.Alignment = StringAlignment.Far; g.DrawString(outDataType.ToString(), Font, new SolidBrush(Color.Black), Rectangle.Right - 2, Rectangle.Top + 2 * (Rectangle.Height / 3) - 7, sf); //the rectangle around the shape //g.DrawRectangle(blackpen,Rectangle.Left,Rectangle.Top,Rectangle.Width,Rectangle.Height); }