TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Joe Daniels
NA
1
1.2k
drawing on a panel using lineshape with vbnet 2010
Aug 19 2014 1:33 PM
I have a vbnet app that has a lineshape (Line1) located in a panel (Panel1)
I want to draw line1 using panel1's mousedown - mousemove and mouseup.
I can get line1 to start and stop where I want and it becomes visible on mouseup
but would like it to be visible during mousemove.
I am using vbnet express 2010 on windows 8
Here is my code
Public Class Form1
Dim LoadPic As String
Private startX As Integer 'start position x of line
Private startY As Integer 'start position y of line
Private isMouseDown As Boolean = False 'recognize mouse down or up
Private Sub btnLoad_Click(sender As System.Object, e As System.EventArgs) Handles btnLoad.Click
FD1.ShowDialog()
LoadPic = FD1.FileName
Panel1.BackgroundImage = Image.FromFile(LoadPic)
End Sub
Private Sub Panel1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
Line1.Visible = True
startX = e.X
startY = e.Y
End Sub
Private Sub Panel1_mousemove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
If isMouseDown = True Then
Line1.X1 = startX
Line1.Y1 = startY
Line1.X2 = e.X
Line1.Y2 = e.Y
End If
End Sub
Private Sub Panel1_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
Line1.X1 = startX
Line1.Y1 = startY
Line1.X2 = e.X
Line1.Y2 = e.Y
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Line1.Visible = False
End Sub
End Class
Reply
Answers (
0
)
How to receive a mail from Gmail using windows application
sql group by clause