0

以下のように、CreateGraphics() オブジェクトに一般的な形状を描画しているパネルがある場合:

            public static void DrawRoundRectWithText(Graphics g, Pen p, float x, float y, float width, float height, float radius, string textFirstLike, string textSecondsLine, bool hasGate, Color color)
    {
        System.Drawing.Graphics formGraphics = g;
        g.InterpolationMode = InterpolationMode.High;
        g.SmoothingMode = SmoothingMode.HighQuality;


        drawBrush.Color = color;
        Rectangle rect = new Rectangle((int)x, (int)y, (int)width, (int)height);
        p.Width = RECTANGLE_BORDER;

        formGraphics.FillRectangle(drawBrush, rect);
        p.Color = RECTANGLE_COLOR;
        formGraphics.DrawRectangle(p, rect);


        DrawString(g, textFirstLike, x + TEXT_OFFSET_X, y + height / 4, PRIMARY_TEXT_FONT_SIZE, (int)width);
        DrawString(g, textSecondsLine, x + TEXT_OFFSET_X, y + height / 2, SECONDARY_TEXT_FONT_SIZE, (int)width);

        int gateWidth = QuestNode.GATE_RADIUS;
        int gateHeight = QuestNode.GATE_RADIUS;

        if (hasGate)
        {

            drawBrush.Color = GATE_COLOR;
            Rectangle circle = new Rectangle((int)(x + width) - gateWidth/2, (int)(y + height) - gateHeight/2, gateWidth, gateHeight);

            formGraphics.FillEllipse(drawBrush, circle);
            formGraphics.DrawEllipse(p, circle);

        }

        Point[] diamondPoints = new Point[4];
        diamondPoints[0] = new Point((int)(x - gateWidth / 2), (int)y);
        diamondPoints[1] = new Point((int)x, (int)(y - gateHeight / 2));
        diamondPoints[2] = new Point((int)(x + gateWidth / 2), (int)y);
        diamondPoints[3] = new Point((int)x, (int)(y + gateHeight / 2));

        drawBrush.Color = Color.LightGray;
        formGraphics.FillPolygon(drawBrush, diamondPoints);
        formGraphics.DrawPolygon(p, diamondPoints);
    }

ここに画像の説明を入力

パネルをズームイン/ズームアウトして、形状を自動的に縮小する方法はありますか?

4

0 に答える 0