Results 1 to 11 of 11

Thread: [RESOLVED] [VS2005/CE] How to determine is mouse click was on a label

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [VS2005/CE] How to determine is mouse click was on a label

    Nevermind, I have no clue. lol

  2. #2

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [VS2005/CE] How to determine is mouse click was on a label

    Ok - I'm trying to use MOUSEPOSITION.X and .Y in the FORM_CLICK event and comparing it to a LABEL TOP/LEFT/WIDTH and HEIGHT.

    And apparently the MOUSEPOSITION includes the "top line" of the form but the x/y of the label does not include that area.

    Any ideas on how to measure or realize the size of the top bar on the form?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [VS2005/CE] How to determine is mouse click was on a label

    I started using the MOUSEDOWN event - it's working much better.

    Code:
        Private Sub APC_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
            Label.Text = MousePosition.X.ToString & " " & MousePosition.Y.ToString
        End Sub
    
        Private Sub APC_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
            lblStatus.Text = e.X.ToString & " " & e.Y.ToString
        End Sub
    The _CLICK takes into account the "top bar" and the _MOUSEDOWN is the useable area of the FORM - and that's what the label placement is based on.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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