0

我正在页面上打印图表。我可以绘制和修改图形,但它有一些无法更改或删除的网格线。这是代码和屏幕截图:

        Chart chart2 = new Chart();
        ChartArea area2 = new ChartArea();

        chart2.ChartAreas.Add(area2);
        Series s2 = new Series();
        s2.Name = "S2";
        s2.ChartType = SeriesChartType.Line;
        s2.XValueType = ChartValueType.Double;
        s2.YValueType = ChartValueType.Double;
        chart2.Series.Add(s2);
        chart2.Series["S2"].Points.DataBindXY(x2, y2);


        Rectangle myRec1 = new System.Drawing.Rectangle(30,25,100,100);
        // draw!
        chart2.Printing.PrintPaint(e.Graphics, myRec1);

图片 :截屏

我尝试了几乎所有系列和SO的属性,但我认为这不是原因。

4

1 回答 1

1

将以下语句中的适当语句添加到您的代码中;

area2.AxisX.MajorGrid.Enabled  = False
area2.AxisX2.MajorGrid.Enabled = False
area2.AxisY.MajorGrid.Enabled  = False
area2.AxisY2.MajorGrid.Enabled = False
area2.AxisX.MinorGrid.Enabled  = False
area2.AxisX2.MinorGrid.Enabled = False
area2.AxisY.MinorGrid.Enabled  = False
area2.AxisY2.MinorGrid.Enabled = False
于 2013-04-22T14:44:57.620 回答