Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change zedgraph pane background color

Tags:

c#

zedgraph

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.

like image 673
Otiel Avatar asked Aug 09 '11 14:08

Otiel


2 Answers

myChart.GraphPane.Chart.Fill.Color = System.Drawing.Color.Black;
like image 172
SpeziFish Avatar answered Sep 27 '22 23:09

SpeziFish


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 :)

like image 20
Fábio Noga Avatar answered Sep 28 '22 00:09

Fábio Noga