datavisualization chart grid line color change

bones

Well-known member
Joined
Aug 23, 2014
Messages
143
Programming Experience
Beginner
I need to set the chartarea gridline colors to white when the background color is set to black. Can't get this to work...

Been fiddling with this all morning and looking at example code..

VB.NET:
 With Chart1.ChartAreas(0)
            Chart1.BorderSkin.SkinStyle = BorderSkinStyle.FrameThin3
            .AxisX.Interval = 1
            .AxisY.Interval = 10
            .AxisX.IsLabelAutoFit = True
            .AxisY.IsStartedFromZero = CheckBox3.AutoCheck.GetTypeCode
            .AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.DecreaseFont
            .AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.DecreaseFont
            .AxisX.LabelStyle.Angle = -45
            .AxisX.Title = "Lift"
            .AxisY.Title = "CFM"
            .BackColor = cboChartAreaColor.SelectedItem


            If cboChartAreaColor.SelectedItem = Color.Black Then
                .AxisX.MajorGrid.LineColor = System.Drawing.Color.White
                .AxisY.MajorGrid.LineColor = System.Drawing.Color.White
            End If


        End With
 
Found the solution...

I moved this code

VB.NET:
If cboChartAreaColor.SelectedItem = Color.Black Then
                .AxisX.MajorGrid.LineColor = System.Drawing.Color.White
                .AxisY.MajorGrid.LineColor = System.Drawing.Color.White
            End If

from the form load event to the code for the combobox that changes the backcolor.. Now that I think about it ..makes perfect sense.
 
Back
Top