-
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
-
change Height to scaleheight and Width to Scalewidth
-
Or do the conversions yourself....
Code:
Me.Height / Screen.TwipsPerPixelY
Me.Width / Screen.TwipsPerPixelX
picFly.Height / Screen.TwipsPerPixelY
picFly.Width / screen.TwipsPerPixelX
-
eh, the height includes titlebar
-
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)
'.......
;)
-
Right, and that's gotta be better because it uses api's right? Say shouldn't we stay with ScaleHeight and Scalewidth
-
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
-
Make sure that your form's scalemode is 3 - vbPixels
-
Thanx!
My little problem is no more.. :)