Changing the background color of the zedgraph panel

Can I change the background color (white by default) of the zedgraph panel?

I tried to change the background color of the zedgraph element, but it does not give any visible result, the background is still white:

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

And there seems to be no Color or BackColor ZedGraphControl.GraphPane on ZedGraphControl.GraphPane .

+6
source share
3 answers

you can use

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

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

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

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

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

EDIT: I know that you already solved your problem, but I did it, so if someone is looking for him, he can quickly solve his problem :)

+4
source
 myChart.GraphPane.Chart.Fill.Color = System.Drawing.Color.Black; 
+5
source

myChart.GraphPane.Fill.Color = System.Drawing.Color.Black; will create a gradient fill started in black. If you do not want to use a gradient, you should use -

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

Hope this solves your problem.

+4
source

Source: https://habr.com/ru/post/894635/


All Articles