Results 1 to 9 of 9

Thread: [RESOLVED] detect click event outside a form's boundary

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    376

    Resolved [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?

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: detect click event outside a form's boundary

    I have no idea what you're asking. Perhaps a visualization would help?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3
    Addicted Member Mal1t1a's Avatar
    Join Date
    Mar 2008
    Posts
    157

    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.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: detect click event outside a form's boundary

    do you mean the forms showintaskbar button?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    376

    Re: detect click event outside a form's boundary

    yea i want to access the click of the showintaskbar's button

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    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

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    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:
    1. Dim gp As New Drawing.Drawing2D.GraphicsPath
    2. Dim r As Rectangle = Me.ClientRectangle
    3. r.Offset(0, SystemInformation.CaptionHeight + 2)
    4. gp.AddRectangle(r)
    5. Me.Region = New Region(gp)

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    376

    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?

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [RESOLVED] detect click event outside a form's boundary

    heres how:
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width