Drawing Lines to Grid Points, with Snap to Grid Feature

Category:
Screen/Graphics
Type:
Modules
Difficulty:
Intermediate
Author:
Ethan

Version Compatibility: Visual Basic 6

More information:
This demo app contain a form module with code that shows how to:
  • Create Transparent RubberBand drawing lines
  • Draw single or multiple lines on a graphic object
  • Calculate and display grid points
  • Calculate or plot the nearest grid point to the current X and Y
  • 'Snap' or draw the lines to those points
Instructions:

One left mouse click turns the line drawing on and anchors the starting point of the line. A second click of the left button sets the end of the line. Right clicking the mouse terminates the current Line. Turn the Snap to grid points and the multiline drawing on and off by checking the appropriate box.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download multilin.zip