コード例 #1
0
ファイル: ItemTab.cs プロジェクト: Rybadour/Foreman
        public override void Paint(Graphics graphics)
        {
            Point iconPoint = Point.Empty;

            if (Type == LinkType.Output)
            {
                iconPoint = new Point((int)(border * 1.5), Height - (int)(border * 1.5) - iconSize);
            }
            else
            {
                iconPoint = new Point((int)(border * 1.5), (int)(border * 1.5));
            }

            if (Type == LinkType.Output)
            {
                GraphicsStuff.FillRoundRect(0, 0, Width, Height, border, graphics, fillBrush);
                GraphicsStuff.DrawRoundRect(0, 0, Width, Height, border, graphics, borderPen);
                graphics.DrawString(Text, font, textBrush, new PointF(Width / 2, (textHeight + border) / 2), centreFormat);
            }
            else
            {
                GraphicsStuff.FillRoundRect(0, 0, Width, Height, border, graphics, fillBrush);
                GraphicsStuff.DrawRoundRect(0, 0, Width, Height, border, graphics, borderPen);
                graphics.DrawString(Text, font, textBrush, new PointF(Width / 2, Height - (textHeight + border) / 2), centreFormat);
            }
            graphics.DrawImage(Item.Icon ?? DataCache.UnknownIcon, iconPoint.X, iconPoint.Y, iconSize, iconSize);
        }
コード例 #2
0
        private void DrawTooltip(Point screenArrowPoint, Point screenSize, Direction direction, Graphics graphics, String text = "")
        {
            int   border      = 2;
            int   arrowSize   = 10;
            Point arrowPoint1 = new Point();
            Point arrowPoint2 = new Point();

            stringFormat.LineAlignment = StringAlignment.Center;

            switch (direction)
            {
            case Direction.Down:
                arrowPoint1            = new Point(screenArrowPoint.X - arrowSize / 2, screenArrowPoint.Y - arrowSize);
                arrowPoint2            = new Point(screenArrowPoint.X + arrowSize / 2, screenArrowPoint.Y - arrowSize);
                stringFormat.Alignment = StringAlignment.Center;
                break;

            case Direction.Left:
                arrowPoint1            = new Point(screenArrowPoint.X + arrowSize, screenArrowPoint.Y - arrowSize / 2);
                arrowPoint2            = new Point(screenArrowPoint.X + arrowSize, screenArrowPoint.Y + arrowSize / 2);
                stringFormat.Alignment = StringAlignment.Near;
                break;

            case Direction.Up:
                arrowPoint1            = new Point(screenArrowPoint.X - arrowSize / 2, screenArrowPoint.Y + arrowSize);
                arrowPoint2            = new Point(screenArrowPoint.X + arrowSize / 2, screenArrowPoint.Y + arrowSize);
                stringFormat.Alignment = StringAlignment.Center;
                break;

            case Direction.Right:
                arrowPoint1            = new Point(screenArrowPoint.X - arrowSize, screenArrowPoint.Y - arrowSize / 2);
                arrowPoint2            = new Point(screenArrowPoint.X - arrowSize, screenArrowPoint.Y + arrowSize / 2);
                stringFormat.Alignment = StringAlignment.Near;
                break;
            }

            Rectangle rect = getTooltipScreenBounds(screenArrowPoint, screenSize, direction);

            Point[] points = new Point[] { screenArrowPoint, arrowPoint1, arrowPoint2 };
            graphics.FillPolygon(Brushes.DarkGray, points);
            GraphicsStuff.FillRoundRect(rect.X - border, rect.Y - border, rect.Width + border * 2, rect.Height + border * 2, 3, graphics, Brushes.DarkGray);

            Point point;

            if (stringFormat.Alignment == StringAlignment.Center)
            {
                point = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
            }
            else
            {
                point = new Point(rect.X, rect.Y + rect.Height / 2);
            }
            graphics.DrawString(text, size10Font, Brushes.White, point, stringFormat);
        }
コード例 #3
0
        public override void Paint(Graphics graphics)
        {
            if ((DisplayedNode is RecipeNode && !((RecipeNode)DisplayedNode).BaseRecipe.Enabled) || DisplayedNode.ManualRateNotMet())
            {
                GraphicsStuff.FillRoundRect(-5, -5, Width + 10, Height + 10, 13, graphics, Brushes.DarkRed);
            }

            GraphicsStuff.FillRoundRect(0, 0, Width, Height, 8, graphics, backgroundBrush);
            graphics.DrawString(text, size10Font, textBrush, Width / 2, Height / 2, centreFormat);

            base.Paint(graphics);
        }
コード例 #4
0
ファイル: NodeElement.cs プロジェクト: Stonemuzzle/Foreman
        public override void Paint(Graphics graphics)
        {
            GraphicsStuff.FillRoundRect(0, 0, Width, Height, 8, graphics, backgroundBrush);
            graphics.DrawString(text, size10Font, Brushes.White, Width / 2, Height / 2, centreFormat);

            if (editorBox != null)
            {
                TooltipInfo ttinfo = new TooltipInfo();
                ttinfo.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(editedItem));
                ttinfo.Direction      = Direction.Up;
                ttinfo.ScreenSize     = new Point(editorBox.Size);
                Parent.AddTooltip(ttinfo);
            }

            base.Paint(graphics);
        }