How to Draw a Grid on a Panel in VB.NET

Written by alexander gokhfeld
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Draw a Grid on a Panel in VB.NET
You can draw grid lines in VB.NET by using shape layers. (Jupiterimages/ Images)

The Visual Basic for ASP.NET (VB.NET) is a part of the Windows Presentation Foundation (WPF) in the Microsoft .NET Framework. WPF gives software developers the ability to access multiple graphics layers and presentation controls in the VB.NET programs. Shape objects are the top layer of the graphics presentation. It enables you to draw the objects, such as the ellipse, rectangle and grid line on the screen. They can be located inside of the panel form and most of VB.NET controls. You need to define the line element properties to draw a grid line on a panel in VB.NET.

Skill level:
Moderately Easy

Other People Are Reading


  1. 1

    Click the "Start" button in Windows and select the "Microsoft Visual Studio."

  2. 2

    Click the "Open" and select the Visual Basic ASP.NET (VB.NET) program you want to use to draw a grid line on a panel.

  3. 3

    Add the following code after the "protected override" line in your VB.NET program:

    Dim my Line As New Line()

    myLine.Stroke = Brushes.LightSteelBlue

    myLine.X1 = 1

    myLine.X2 = 40

    myLine.Y1 = 1

    myLine.Y2 = 40

    myLine.HorizontalAlignment = HorizontalAlignment.Left

    myLine.VerticalAlignment = VerticalAlignment.Center

    myLine.StrokeThickness = 3


  4. 4

    Click the "File," "Save" to add the function of drawing a grid line on a panel in your VB.NET program.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.