Results 1 to 9 of 9

Thread: How to get the pic to stay in the form?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Norway
    Posts
    32

    Cool

    The pic don't leave the form in the top, or left side, but i cant get it to not leave the form in the bottom, or right side..

    What's wrong?

    Code:
        If blnKeys(vbKeyUp) Then
            If picFly.Top > 0 Then
                picFly.Top = picFly.Top - 1
            End If
        End If
    
        If blnKeys(vbKeyDown) Then
            If picFly.Top < Me.Height Then
                picFly.Top = picFly.Top + 1
            End If
        End If
    
        If blnKeys(vbKeyLeft) Then
            If picFly.Left > Me.Left Then
                picFly.Left = picFly.Left - 1
            End If
        End If
    
        If blnKeys(vbKeyRight) Then
             If (picFly.Left + picFly.Width) > Me.Width - 100 Then
               picFly.Left = Me.Width - picFly.Width - 100
            End If
        End If

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    change Height to scaleheight and Width to Scalewidth
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Or do the conversions yourself....

    Code:
    Me.Height / Screen.TwipsPerPixelY
    Me.Width / Screen.TwipsPerPixelX
    
    picFly.Height / Screen.TwipsPerPixelY
    picFly.Width / screen.TwipsPerPixelX
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    eh, the height includes titlebar
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    To get the height of the form minus the TitleBar...

    Code:
    Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    
    Private Const SM_CYCAPTION = 4
    
    '.........
    (Me.Height / Screen.TwipsPerPixelY) - GetSystemMetrics(SM_CYCAPTION)
    '.......
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Right, and that's gotta be better because it uses api's right? Say shouldn't we stay with ScaleHeight and Scalewidth
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Why I've been wasting my morning on this post:

    1. Mobic doesn't need the Height or Width in Pixels
    2. ScaleHeight returns the Height minus the titlebar

    YoungBuck = BurntOut
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Make sure that your form's scalemode is 3 - vbPixels
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Norway
    Posts
    32

    Talking

    Thanx!

    My little problem is no more..

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