Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Mouse Move Paint
Author:
Divya M
E-mail:
Click to e-mail author
Submitted:
1/17/2011
Version:
VB 2005
Compatibility:
VB 2005, VB 2008, VB 2010
Category:
Graphics
Views:
13943
A simple program for drawing using mouse move event in vb.net 2005 version...
Declarations:
Steps For Creation:- ===================== 1. Change the background color of the form1 as white. 2. Then, double click the form and change the event as mouse move click event. 3. Now, write the code given below. 4. Save all and run the form.
Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Cursor = Cursors.Hand End Sub Dim shouldPaint As Boolean = False Private Sub MouseEvent_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown shouldPaint = True End Sub Private Sub MouseEvent_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove If shouldPaint Then Dim graphic As Graphics = CreateGraphics() graphic.FillEllipse(New SolidBrush(Color.Magenta), e.X, e.Y, 10, 5) End If End Sub Private Sub MouseEvent_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp shouldPaint = False End Sub End Class
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement