Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a simple way to draw lines in VB.Net Winforms?
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00956009
Message ID:
00956580
Views:
7
Make a line control:

Create a Windows Library add a class with this code:

Public Class Line
Inherits Windows.Forms.Control

Public Sub New()
SetStyle(Windows.Forms.ControlStyles.ResizeRedraw, True)
End Sub

Private Sub Line_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
e.Graphics.DrawLine(New Drawing.Pen(Me.ForeColor), 0, 0, Me.Width - 1, Me.Height - 1)
End Sub
End Class

then:
- Compile the class library
- Right click the ToolBox, point to add remove items
- Click browse
- Look for the compiled dll
- Click OK
- The line control should be in the toolbar
- Drag it into your form.
Previous
Reply
Map
View

Click here to load this message in the networking platform