Results 1 to 3 of 3

Thread: [RESOLVED] CheckBox MouseMove method not behaving as advertised

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Location
    Johannesburg, South Africa
    Posts
    92

    Resolved [RESOLVED] CheckBox MouseMove method not behaving as advertised

    I am trying to do some manipulation based on x,y arguments supplied by the MouseMove event but they appear to be coming through as twips at runtime rather than pixels.

    MSDN says:
    (x,y) - A number that specifies the current location of the mouse pointer. The x and y values are always expressed in terms of the coordinate system set by the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.
    The parent container has ScaleMode set to pixels so what's going on here?

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: CheckBox MouseMove method not behaving as advertised

    Every windows control has its own device context. As far as I can remember, even PictureBox scalemodes stay as Twips when your parent form is set to Pixels.

    What you can do.. is convert it. Something like..
    Code:
    Private Sub CheckBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    X = X / Screen.TwipsPerPixelX
    Y = Y / Screen.TwipsPerPixelY
    
    Debug.Print "X: "; X
    Debug.Print "Y: "; Y
    End Sub
    chem
    Last edited by chemicalNova; Feb 29th, 2008 at 07:31 AM.

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2006
    Location
    Johannesburg, South Africa
    Posts
    92

    Re: CheckBox MouseMove method not behaving as advertised

    Thanks chem...that worked.

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