[RESOLVED] detect click event outside a form's boundary
ok what i have now. a form without borders through this:
Code:
Me.FormBorderStyle = FormBorderStyle.None
what is happening now: i click the area in the taskbar which "belongs" to my form, while it is being shown, the form remains "shown"
what i hope to get done: if the form is "shown" and i click the taskbar of my form, i want it hidden
questions:
could we detect click event of the form's area in the taskbar?
Re: detect click event outside a form's boundary
I have no idea what you're asking. Perhaps a visualization would help?
Re: detect click event outside a form's boundary
Code:
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
If e.Y > Me.Height - 100 Then
'Do Events
End If
End Sub
Could this perhaps be what you're looking for? As the above post says, I don't quite understand the question either.
Re: detect click event outside a form's boundary
do you mean the forms showintaskbar button?
Re: detect click event outside a form's boundary
yea i want to access the click of the showintaskbar's button
Re: detect click event outside a form's boundary
its not a simple task.
i'm not sure how, but you need to get the taskbars window handle, then get the window handle of the button, then hook the WM_MOUSEDOWN message.
this might help
Re: detect click event outside a form's boundary
there is an easier way, where you change your formborderstyle back to the default formborderstyle, then use this code in your form_load event, which will give your form the look of no borders with the functionality of a form with default formborderstyle:
vb Code:
Dim gp As New Drawing.Drawing2D.GraphicsPath
Dim r As Rectangle = Me.ClientRectangle
r.Offset(0, SystemInformation.CaptionHeight + 2)
gp.AddRectangle(r)
Me.Region = New Region(gp)
Re: detect click event outside a form's boundary
hey both works great thanks. anyways this sound stupid but i cant find out how do we put the [VB 2008] tag?
1 Attachment(s)
Re: [RESOLVED] detect click event outside a form's boundary