JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!



Drawing Lines


C

keyboard_arrow_up
0
keyboard_arrow_down


First Post Mark as Spam codymihelich
Posts: 2 - Registered: 2013-09-12 17:06:41

Hello! I am a fellow programmer and I need your help. I am trying to create a program that draws STRAIGHT lines from 1 point (click) to the next point (click). I have managed to create one that draws a line, but it just follows the mouse... Can some one please help me, I've tried many different things. I am using a picture box to draw on. Here is the code I made for the random draw line.
Imports System.Drawing.Drawing2D


Public Class Designer


Dim lastPos
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)


If e.Button = Windows.Forms.MouseButtons.Left Then
Dim graphicPath As New GraphicsPath
graphicPath.AddLine(lastPos.X, lastPos.Y, e.X, e.Y)
PictureBox1.CreateGraphics.DrawPath(Pens.Black, graphicPath)

End If
lastPos = e.Location
End Sub


Private Sub Designer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddItems.Visible = True
End Sub

End Class


Thank you so much for your time,
~Papa Beans




C

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 Mark as Spam codymihelich
Posts: 2 - Registered: 2013-09-12 17:06:41

Anyone have any help to give?






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising