public void Paint(PortShape shape, Graphics g)
        {
            Rectangle rect = shape.Rectangle;

            g.SmoothingMode = SmoothingMode.HighQuality;

            GraphicsPath path = new GraphicsPath();

            path.AddArc(rect.X, rect.Y, 20, 20, -180, 90);
            path.AddLine(rect.X + 10, rect.Y, rect.X + rect.Width - 10, rect.Y);
            path.AddArc(rect.X + rect.Width - 20, rect.Y, 20, 20, -90, 90);
            path.AddLine(rect.X + rect.Width, rect.Y + 10, rect.X + rect.Width, rect.Y + rect.Height - 10);
            path.AddArc(rect.X + rect.Width - 20, rect.Y + rect.Height - 20, 20, 20, 0, 90);
            path.AddLine(rect.X + rect.Width - 10, rect.Y + rect.Height, rect.X + 10, rect.Y + rect.Height);
            path.AddArc(rect.X, rect.Y + rect.Height - 20, 20, 20, 90, 90);
            path.AddLine(rect.X, rect.Y + rect.Height - 10, rect.X, rect.Y + 10);

            //the shadow
            Region darkRegion = new Region(path);

            darkRegion.Translate(4, 4);
            g.FillRegion(ArtPallet.ShadowBrush, darkRegion);

            //the actual shape
            g.FillPath(shape.Brush, path); //Brushes.White

            //the edge of the bundle
            if (shape.Hovered || shape.IsSelected)
            {
                g.DrawPath(ArtPallet.HighlightPen, path);
            }
            else
            {
                g.DrawPath(shape.Pen, path);
            }

            //the connectors
            Brush cBrush = ArtPallet.GetSolidBrush(Color.Gray, 255); //Color.SteelBlue

            foreach (YttriumConnector c in shape.OutputConnectors)
            {
                g.FillRectangle(cBrush, c.Point.X - 7, c.Point.Y - 12, 7, 24);
                g.FillPie(cBrush, c.Point.X - 18, c.Point.Y - 12, 24, 24, 90, 180);
                //g.FillEllipse(cBrush, c.Point.X - 12, c.Point.Y - 12, 24, 24);
            }
            foreach (IConnector c in shape.Connectors)
            {
                c.Paint(g);
            }

            if (shape.Port != null)
            {
                IEntity entity = shape.Port.Entity;
                g.DrawString(entity.Symbol, ArtPallet.DefaultBoldFont, Brushes.Black, shape.TextRectangle.X, shape.TextRectangle.Y);
                g.DrawString(entity.EntityId.Domain, ArtPallet.DefaultFont, Brushes.Black, shape.TextRectangle.X, shape.TextRectangle.Y + 15);
                g.DrawString(entity.EntityId.Label, ArtPallet.DefaultFont, Brushes.Black, shape.TextRectangle.X, shape.TextRectangle.Y + 30);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Paints the bundle on the canvas
        /// </summary>
        /// <param name="g"></param>
        public override void Paint(Graphics g)
        {
            g.SmoothingMode = SmoothingMode.HighQuality;

            GraphicsPath path = new GraphicsPath();

            path.AddArc(Rectangle.X, Rectangle.Y, 20, 20, -180, 90);
            path.AddLine(Rectangle.X + 10, Rectangle.Y, Rectangle.X + Rectangle.Width - 10, Rectangle.Y);
            path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y, 20, 20, -90, 90);
            path.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y + 10, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height - 10);
            path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y + Rectangle.Height - 20, 20, 20, 0, 90);
            path.AddLine(Rectangle.X + Rectangle.Width - 10, Rectangle.Y + Rectangle.Height, Rectangle.X + 10, Rectangle.Y + Rectangle.Height);
            path.AddArc(Rectangle.X, Rectangle.Y + Rectangle.Height - 20, 20, 20, 90, 90);
            path.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height - 10, Rectangle.X, Rectangle.Y + 10);

            //shadow
            Region darkRegion = new Region(path);

            darkRegion.Translate(4, 4);
            g.FillRegion(ArtPallet.ShadowBrush, darkRegion);

            //background
            g.FillPath(Brushes.White, path);

            //the border
            if (Hovered || IsSelected)
            {
                g.DrawPath(ArtPallet.HighlightPen, path);
            }
            else
            {
                g.DrawPath(Pen, path);
            }

            //the connectors
            Brush cBrush = ArtPallet.GetSolidBrush(Color.Gray, 255); //Color.SteelBlue

            foreach (Connector c in cOut)
            {
                g.FillRectangle(cBrush, c.Point.X - 7, c.Point.Y - 12, 7, 24);
                g.FillPie(cBrush, c.Point.X - 18, c.Point.Y - 12, 24, 24, 90, 180);
                //g.FillEllipse(cBrush, c.Point.X - 12, c.Point.Y - 12, 24, 24);
            }
            for (int k = 0; k < Connectors.Count; k++)
            {
                Connectors[k].Paint(g);
            }

            if (port != null)
            {
                g.DrawString(port.Entity.Symbol, ArtPallet.DefaultBoldFont, Brushes.Black, TextRectangle.X, TextRectangle.Y);
                g.DrawString(port.Entity.EntityId.Domain, ArtPallet.DefaultFont, Brushes.Black, TextRectangle.X, TextRectangle.Y + 15);
                g.DrawString(port.Entity.EntityId.Label, ArtPallet.DefaultFont, Brushes.Black, TextRectangle.X, TextRectangle.Y + 30);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructs a connection between the two given points
 /// </summary>
 /// <param name="mFrom">the starting point of the connection</param>
 /// <param name="mTo">the end-point of the connection</param>
 /// <param name="model">The model.</param>
 public YttriumConnection(Point mFrom, Point mTo, IModel model) : base(model)
 {
     _connectionState = ConnectionStates.Unassigned;
     _reverse         = false;
     this.From        = new Connector(mFrom, model);
     this.From.Name   = "From";
     this.From.Parent = this;
     this.To          = new Connector(mTo, model);
     this.To.Name     = "To";
     this.To.Parent   = this;
     PenStyle         = ArtPallet.GetDefaultPenStyle();
 }
Ejemplo n.º 4
0
        public void Paint(PortShape shape, Graphics g)
        {
            Rectangle rect = shape.Rectangle;

            g.SmoothingMode = SmoothingMode.HighQuality;

            //the shadow
            g.FillRectangle(ArtPallet.ShadowBrush, rect.X + 3, rect.Y + 3, rect.Width, rect.Height);

            //the actual shape
            g.FillRectangle(shape.Brush, rect);

            //the edge of the bundle
            if (shape.Hovered || shape.IsSelected)
            {
                g.DrawRectangle(ArtPallet.HighlightPen, rect);
            }
            else
            {
                g.DrawRectangle(shape.Pen, rect);
            }

            //the connectors
            Brush cBrush = ArtPallet.GetSolidBrush(Color.Gray, 255); //Color.SteelBlue

            foreach (YttriumConnector c in shape.OutputConnectors)
            {
                //g.FillRectangle(cBrush, c.Point.X - 7, c.Point.Y - 12, 7, 24);
                //g.FillPie(cBrush, c.Point.X - 18, c.Point.Y - 12, 24, 24, 90, 180);
                //g.FillEllipse(cBrush, c.Point.X - 12, c.Point.Y - 12, 24, 24);
            }
            foreach (IConnector c in shape.Connectors)
            {
                c.Paint(g);
            }
        }