Write VB.NET program to display the status of mouse using label controls program should display current x,y postions of mouse .when user clicks left or right buttons lable should indicate which button is pressed.program should also indicate double click.When user clicks on close,show summery report as given below.
Public Class Form1 Dim L, R, D As Integer Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Form2.lblLeft.Text = L Form2.lblRight.Text = R Form2.lblDouble.Text = D Form2.ShowDialog() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load L = R = D End Sub Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick If e.Button = MouseButtons.Left Then lblButtonpressed.Text = "left" L = L + 1 ElseIf e.Button = MouseButtons.Right Then lblButtonpressed.Text = "right" R = R + 1 ElseIf e.Button = MouseButtons.Middle Then lblButtonpressed.Text = "middle" End If End Sub Private Sub Form1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDoubleClick D = D + 1 End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove lblXpos.Text = e.X lblYpos.Text = e.Y End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End End Sub End Class
Write VB.NET program to display the status of mouse using label controls program should display current x,y postions of mouse .when user clicks left or right buttons lable should indicate which button is pressed.program should also indicate double click.When user clicks on close,show summery report as given below.
Reviewed by
on
April 27, 2015
Rating: