Change zedgraph pane background color

 ̄綄美尐妖づ 提交于 2019-11-30 03:57:59

问题


Is it possible to change the background color (white by default) of a zedgraph pane?

I tried changing the background color of the zedgraph element, but it doesn't give any visible result, background is still white:

ZedGraphControl.BackColor = System.Drawing.Color.Black;

And there doesn't seem to exist a Color or BackColor property on ZedGraphControl.GraphPane.


回答1:


You can use

zg.GraphPane.Chart.Fill.Color = SystemColors.ControlText;

to change the background [only] of the chart. If you want to change the background color the zedgraph except the chart, use

zg.GraphPane.Fill.Color = SystemColors.ControlText;

If you want to change the background color of everything in the zedgraph, use both:

zg.GraphPane.Chart.Fill.Color = SystemColors.ControlText;
zg.GraphPane.Fill.Color = SystemColors.ControlText;

EDIT: I know that you already solved your problem but I made this so if someone searches it, he can solve his problem quickly :)




回答2:


myChart.GraphPane.Chart.Fill.Color = System.Drawing.Color.Black;



回答3:


myChart.GraphPane.Fill.Color = System.Drawing.Color.Black; will create a gradient fill started with black color. If you don't want to use gradient you should use -

myChart.GraphPane.Chart.Fill.Brush = new System.Drawing.SolidBrush(Color.Black);

Hope this will solve your problem.



来源:https://stackoverflow.com/questions/6997690/change-zedgraph-pane-background-color

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!