C# 在对象上绘制文本

C# 在对象上绘制文本,c#,C#,我正在使用此方法在对象上绘制虚线: // Get Graphics object from chart Graphics graph = e.ChartGraphics.Graphics; PointF point1 = PointF.Empty; PointF point2 = PointF.Empty; // Set Maximum and minimum points point1.X = -110;

我正在使用此方法在对象上绘制虚线:

// Get Graphics object from chart
        Graphics graph = e.ChartGraphics.Graphics;

        PointF point1 = PointF.Empty;
        PointF point2 = PointF.Empty;

        // Set Maximum and minimum points
        point1.X = -110;
        point1.Y = -110;
        point2.X = 122;
        point2.Y = 122;

        // Convert relative coordinates to absolute coordinates.
        point1 = e.ChartGraphics.GetAbsolutePoint(point1);
        point2 = e.ChartGraphics.GetAbsolutePoint(point2);

        // Draw (dashed) connection line
       float[] dashValues = { 4, 2 };
       Pen dashPen= new Pen(Color.Yellow, 3);
       dashPen.DashPattern = dashValues;
       graph.DrawLine(dashPen, point1, point2);

我想知道是否有可能以同样的方式在一个对象上写文本。

你应该看看这个方法。

你应该看看这个方法。

是的,你可以在中完成