예제 #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
        public RecipeChooserControl(Recipe recipe, String text, String filterText) : base(text, filterText)
        {
            InitializeComponent();
            DisplayedRecipe = recipe;

            ColorIcon = recipe.Icon;
            GrayIcon  = GraphicsStuff.MakeMonochrome(recipe.Icon);

            setClickHandler(new MouseEventHandler(RecipeChooserControl_MouseUp), this);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
        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);
        }