图表控件更改轴颜色 [英] Chart control change axis color

查看:156
本文介绍了图表控件更改轴颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的图表控制图

我要从左侧删除轴黑线,并添加蓝线作为框架为所有图表喜欢在按钮。
我搜索所有属性,并尝试更改颜色,但默认颜色仍然保留

I want to remove axis black lines from the left side and add blue line as a frame for all the graph like at the button. I have search for all the properties and try to change color but the default color still remained

推荐答案

自定义图表可以自己动态绘制:

if you want to customize a chart you could draw your own dynamically:

VB.net中的示例:

Example in VB.net:

 Const GraphHeight As Integer = 100
    Const GraphWidth As Integer = 200
    Dim cIMG As New Bitmap(GraphWidth, GraphHeight)
    Dim G As Graphics = Graphics.FromImage(cIMG)
    Dim red As Integer = 0
    Dim pnts(4) As Point
    pnts(0) = New Point(0, GraphHeight - 0)
    pnts(1) = New Point(50, GraphHeight - 80)
    pnts(2) = New Point(100, GraphHeight - 50)
    pnts(3) = New Point(150, GraphHeight - 40)
    pnts(4) = New Point(200, GraphHeight - 20)
    G.DrawLines(Pens.Blue, pnts)
    PictureBox1.Image = cIMG

在C#中的示例:

const int GraphHeight = 100;
const int GraphWidth = 200;
Bitmap cIMG = new Bitmap(GraphWidth, GraphHeight);
Graphics G = Graphics.FromImage(cIMG);
int red = 0;
Point[] pnts = new Point[5];
pnts(0) = new Point(0, GraphHeight - 0);
pnts(1) = new Point(50, GraphHeight - 80);
pnts(2) = new Point(100, GraphHeight - 50);
pnts(3) = new Point(150, GraphHeight - 40);
pnts(4) = new Point(200, GraphHeight - 20);
G.DrawLines(Pens.Blue, pnts);
PictureBox1.Image = cIMG;

您可以使用循环绘制网格

you could use a loop to draw the grid

示例

这篇关于图表控件更改轴颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆