New to Telerik UI for WinForms? Download free 30-day trial

Background Grid

You can control the background settings of the diagramming surface through the following properties:

  • IsBackgroundSurfaceVisible: a boolean property that determines whether the background surface of the RadDiagram should be displayed. Its default value is true.

Set IsBackgroundSurfaceVisible

this.radDiagram1.DiagramElement.IsBackgroundSurfaceVisible = true;

Me.RadDiagram1.DiagramElement.IsBackgroundSurfaceVisible = True

IsBackgroundSurfaceVisible = true IsBackgroundSurfaceVisible = false
WinForms RadDiagram diagram-backgroundgrid 001 WinForms RadDiagram diagram-backgroundgrid 002
  • Background: this property is of type Brush and it controls the fill of the RadDiagram background.

Set Background

this.radDiagram1.DiagramElement.BackgroundGrid.Background = new System.Drawing.SolidBrush(Color.LightYellow);

Me.RadDiagram1.DiagramElement.BackgroundGrid.Background = New System.Drawing.SolidBrush(Color.LightYellow)

Figure 1: Background

WinForms RadDiagram Background

You can access the BackgroundGrid properties:

  • CellSize: this property is of type Telerik.Windows.Diagrams.Core.Size and it controls the size of the cells in the RadDiagram surface. The default value of this property is a size of *20x20 * units.

Figure 2: CellSize

WinForms RadDiagram CellSize

Set CellSize

this.radDiagram1.DiagramElement.BackgroundGrid.CellSize = new Telerik.Windows.Diagrams.Core.Size(40, 40);

Me.RadDiagram1.DiagramElement.BackgroundGrid.CellSize = New Telerik.Windows.Diagrams.Core.Size(40, 40)

  • LineStroke: this property is of type Brush and it specifies how the cells outline is painted.

Figure 3: LineStroke

WinForms RadDiagram LineStroke

Set LineStroke

this.radDiagram1.DiagramElement.BackgroundGrid.LineStroke = new System.Drawing.SolidBrush(Color.Red);

Me.RadDiagram1.DiagramElement.BackgroundGrid.LineStroke = New System.Drawing.SolidBrush(Color.Red)

  • LineStrokeThickness: this property is of type double and it gets or sets the thickness of the RadDiagram background grid lines.

Figure 4: LineStrokeThickness

WinForms RadDiagram LineStrokeThickness

Set LineStrokeThickness

this.radDiagram1.DiagramElement.BackgroundGrid.LineStrokeThickness = 5;

Me.RadDiagram1.DiagramElement.BackgroundGrid.LineStrokeThickness = 5

See Also

In this article