ZedGraph如何去掉外边框?并设置背景颜色

ZedGraph的在显示曲线图的时候,有外边框一直在显示,会显得特别碍眼,如何去掉它呢?
这个是原始的现象
在这里插入图片描述

1 去掉外边框的做法如下:

              //去掉外边框
            this.zedGraph.GraphPane.Border.IsVisible = false;

在这里插入图片描述

2 设置一下背景颜色

    //设置灰色
   this.zedGraph.GraphPane.Fill = new ZedGraph.Fill(Color.FromArgb(120, 120, 120));

  //设置曲线区域的矩形框的颜色  黄色
   this.zedGraph.GraphPane.Chart.Fill = new ZedGraph.Fill(Color.Yellow);

   //设置绘制曲线区域的矩形框的边框颜色 红色
   this.zedGraph.GraphPane.Chart.Border.Color = Color.Red;

效果如下图:
在这里插入图片描述

GraphPane是绘图中主要的类,它包含所有其他类作为属性。还可以设置pane title、pane frame、axis frame以及背景颜色等。GraphPane类是ZedGraph类的外部“包装器”,它提供访问图形属性(比如 YAxis、 XAxis 、CurveList)的接口。

通过GraphPane接口可以访问到的类有

描述描述
CurveListGets or sets the list of CurveItem items for this GraphPane获取或设置此GraphPane的CurveItem项列表
XAxisAccesses the XAxis for this graph访问此图形的XAxis
X2AxisAccesses the X2Axis for this graph访问此图形的X2Axis
YAxisAccesses the primary YAxis for this graph访问此图形的主轴YAxis
Y2AxisAccesses the primary Y2Axis for this graph访问此图形的主轴Y2Axis
YAxisListGets the collection of Y axes that belong to this GraphPane获取属于此GraphPane的Y轴集合
YAxisList2Gets the collection of Y2 axes that belong to this GraphPane获取属于此GraphPane的Y2轴集合
ChartGets the Chart instance for this GraphPane获取此GraphPane的Chart实例
BarSettingsGets the BarSettings instance for this GraphPane获取此GraphPane的BarSettings实例

比如我们修改X轴的标题,

 //通过GraphPane接口访问XAxis,并修改X轴的标题
 this.zedGraph.GraphPane.XAxis.Title.Text = "Hi ,I'm XAxis";

在这里插入图片描述

小结一下:
GraphPane类封装了graph pane,所有的图形相关的元素都与GraphPane相关联。通过GraphPane可以获取其它类(轴、曲线等)的接口。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值