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

How to Draw a Grid on a Panel in VB.NET thumbnail
You can draw grid lines in VB.NET by using shape layers.

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.

Instructions

    • 1

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

    • 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

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

      Dim myLine 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

      myGrid.Children.Add(myLine)

    • 4

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

Related Searches:

References

  • Photo Credit Jupiterimages/Photos.com/Getty Images

Comments

You May Also Like

Related Ads

Featured