Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake a line control in Visual Basic 2005
DescriptionThis example shows how to make a line control in Visual Basic 2005.
Keywordsline control, custom control, Visual Basic 2005
CategoriesControls, Graphics, VB.NET
 
Thanks to Mike for contributing this. Here's his description:
I've created a line control that I thought you might like to add to the VB-Helper site and newsletter. I have an application that requires some simple graphics capability. I'm not ready to convert the whole thing to WPF and the line shape control in the Visual Basic Power Pack lacks line segments. So, I created my own line segment control. It features all of the capabilities of the line shape control in the Power Pack plus it features the methods AddPoint() and DeletePoint().

The AddPoint() method has a couple of overloads. If you call it with no parameters and the mouse is over the line, then it will add a point on the line under the mouse. You can also pass the point to it explicitly.

The DeletePoint() method also has a couple of overloads. If you call it with no parameters, then it will remove the point on the line that is closest to the mouse. You can also explicitly pass the point that you want deleted.

The control has code built in to it to allow the user to drag the points around to reshape the line at runtime.

See the code for details.

 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated