示例#1
0
        public void Render(Graphics g, Rectangle r)
        {
            probeRender.Render(g, r);
            Point p = new Point(r.Left + ((r.Width - renderImage.Width) / 2), r.Top + ((r.Height - renderImage.Height) / 2));

            g.DrawImage(renderImage, p);
        }
示例#2
0
        public void Render(Graphics g, Rectangle r)
        {
            // the ones on the right side are rendererd first, so that if the left text overlaps
            // you can see all of that
            CarPartsListMeasurements equipped = Hardcoded.EquippedPartsListMeasurements;

            Point[] points  = { equipped.TopLeftItemLocation, equipped.TopRightItemLocation, equipped.BottomLeftItemLocation, equipped.BottomRightItemLocation };
            Point   origin  = equipped.PartsListScreenOrigin;
            int     originX = origin.X;
            int     originY = origin.Y;
            int     iter    = 0;

            foreach (Point p in points)
            {
                Point itemLoc = new Point(
                    originX + p.X,
                    originY + p.Y
                    );
                string text = BoxContentsRenderer.textsToRender[BoxContentsRenderer.EQUIPPED_PARTS_TEXT_OFFSET + iter];
                g.DrawString(
                    text,
                    equipped.TextFont,
                    Hardcoded.EquippedPartFontColour,
                    itemLoc,
                    typeFormat
                    );
                ++iter;
            }
            probeRenderer.Render(g, r);
        }
示例#3
0
 public void Render(Graphics g, Rectangle r)
 {
     probeRenderer.Render(g, r);
     if (!probeRenderer.HasRenderContent())
     {
         rectF.Location = new PointF(r.Left, r.Top);
         rectF.Size     = new SizeF(r.Width, r.Height);
         g.DrawString(text, genericSansFont, textColour, rectF, typeFormat);
     }
 }
示例#4
0
        public void Render(Graphics g, Rectangle r)
        {
            g.DrawRectangles(borderPen, itemRects);
            SizeF priceSize = SizeF.Empty;

            if (includePrice)
            {
                priceSize = g.MeasureString(
                    BoxContentsRenderer.textsToRender[BoxContentsRenderer.CARLIST_TEXT_OFFSET + 1],
                    renderMeasurements.TextFont,
                    PointF.Empty,
                    typeFormat
                    );
            }
            Size  swatchSize     = renderMeasurements.SwatchSize;
            Point swatchPosition = renderMeasurements.SwatchPosition;
            Point carNameOffset  = renderMeasurements.CarNameOffset;
            Font  textFont       = renderMeasurements.TextFont;

            foreach (Rectangle items in itemRects)
            {
                Point textLoc  = items.Location;
                Point startLoc = textLoc;
                startLoc.Offset(swatchPosition);
                Rectangle swatchRect = new Rectangle(startLoc, swatchSize);
                g.FillRectangle(swatchGradient, swatchRect);
                textLoc.Offset(carNameOffset);
                g.DrawString(
                    BoxContentsRenderer.textsToRender[BoxContentsRenderer.CARLIST_TEXT_OFFSET + 0],
                    textFont,
                    textColour,
                    textLoc,
                    typeFormat
                    );
                if (includePrice)
                {
                    // this is where the end of the text should be
                    Point pricePoint = new Point(items.Right - 12, items.Top);
                    // then we subtract the width to get the start point
                    pricePoint.Offset((int)-priceSize.Width, 0);
                    g.DrawString(
                        BoxContentsRenderer.textsToRender[BoxContentsRenderer.CARLIST_TEXT_OFFSET + 1],
                        textFont,
                        textColour,
                        pricePoint,
                        typeFormat
                        );
                }
            }
            // these render on top so it's here instead of the top
            probeRenderer.Render(g, r);
        }
示例#5
0
        public void Render(Graphics g, Rectangle r)
        {
            probeRenderer.Render(g, r);
            if (textSize.IsEmpty)
            {
                textSize = g.MeasureString(textToRender, font, PointF.Empty, typeFormat);
            }
            PointF textPos = new PointF(
                xAligner(r, textSize),
                yAligner(r, textSize)
                );

            g.DrawString(textToRender, font, brush, textPos, typeFormat);
        }
示例#6
0
        public override void Draw(Graphics g, Rectangle r, bool drawOutline)
        {
            Rectangle bounds = Bounds;

            if (bounds.IntersectsWith(r))
            {
                renderer.Render(g, bounds);
                Brush anchor = Globals.App.AnchorBrush;
                g.FillRectangle(anchor, centralAnchor);
#if RESIZABLE_ICONIMGS
                g.FillRectangles(anchor, cornerAnchors);
#endif
            }
        }
示例#7
0
        public void Render(Graphics g, Rectangle r)
        {
            probeRenderer.Render(g, r);
            // swatches are aligned top right
            Point lastRect = r.Location;

            lastRect.Offset(r.Width, 0); // so the point starts at the r.Right, the firs rewind will then make it swatchSize.width away rom r.Right
            int numRects   = swatchRects.Length;
            int numColours = swatchColours.Length;
            int rewindSize = -swatchSize.Width;

            for (int i = 0; i < numRects; ++i)
            {
                lastRect.Offset(rewindSize, 0);
                swatchRects[i] = new Rectangle(lastRect, swatchSize);
                g.FillRectangle(swatchColours[i % numColours], swatchRects[i]);
            }
            g.DrawRectangles(Pens.Gray, swatchRects);
        }
示例#8
0
        public void Render(Graphics g, Rectangle r)
        {
            probeRenderer.Render(g, r);
            if (stringSize.IsEmpty)
            {
                stringSize = g.MeasureString(renderText, font);
            }
            // dealership prices are rendered 20 pixels below where they would be
            // if the bottom of the text touched the bottom of the bounding box
            // and 32 pixels to the left of the right side
            //
            // The left and top of the rect don't matter in the text positioning
            // even if the bounding box is a 1x1 square, the whole text is rendered
            float  yPos      = ((stringSize.Height - r.Bottom) + 20) + yAdjustment;
            float  xPos      = (r.Right - 32) + xAdjustment;
            PointF drawPoint = new PointF(xPos, yPos);

            g.DrawString(renderText, font, Hardcoded.DealershipPriceColour, drawPoint, typeFormat);
        }
示例#9
0
        public override void Draw(Graphics g, Rectangle clipRect, bool drawOutline)
        {
            Rectangle loc = Location;

            if (loc.IntersectsWith(clipRect) || hardcodedRenderLoc.IntersectsWith(clipRect))
            {
                Color usedColour = isSelected ? Globals.App.SelectedOutlineColour : outline;
                using (Pen p = new Pen(usedColour))
                {
                    if (drawOutline)
                    {
                        g.DrawRectangle(p, loc);
                    }
                    if (ShowInnerContent && Globals.App.ShowInnerContent)
                    {
                        renderer.Render(g, loc);
                    }
                }
                Brush anchor = Globals.App.AnchorBrush;
                g.FillRectangle(anchor, centralAnchor);
                g.FillRectangles(anchor, cornerAnchors);
            }
        }
示例#10
0
 public void Render(Graphics g, Rectangle r)
 {
     probeRender.Render(g, r);
     g.DrawImage(Hardcoded.CarPicture, r);
 }