|
-
Aug 18th, 2012, 01:28 PM
#1
Thread Starter
New Member
[Solved] Closing Application on Mouse Click
Hi Guys,
I found this small code to create a simple black windows to cover my screen.
Code:
Public Class BS
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.StartPosition = FormStartPosition.CenterScreen
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.WindowState = FormWindowState.Maximized
Me.BackColor = Color.Black
System.Windows.Forms.Cursor.Hide()
End Sub
End Class
I would really like to close it on a simple left mouse click.
I tried to work this out with a couple of google suggestions, but I have no experience in vb so im consulting for help here.
Thanks in advance.
Last edited by Halibu; Aug 19th, 2012 at 12:40 AM.
-
Aug 18th, 2012, 03:58 PM
#2
Re: Closing Application on Mouse Click
you need to handle the MouseClick event:
vb.net Code:
Public Class BS
Private Sub BS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.StartPosition = FormStartPosition.CenterScreen
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.WindowState = FormWindowState.Maximized
Me.BackColor = Color.Black
System.Windows.Forms.Cursor.Hide()
End Sub
Private Sub BS_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
If e.Button = Windows.Forms.MouseButtons.Left Then
Application.Exit()
End If
End Sub
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Aug 19th, 2012, 12:38 AM
#3
Thread Starter
New Member
Re: Closing Application on Mouse Click
Thank you for your help paul. Works like a charm.
I tried this kind of mouse click event, but, as i see the differences, failed at some details
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|