PDA

Click to See Complete Forum and Search --> : How to get the pic to stay in the form?


Mobic
Feb 3rd, 2001, 04:43 AM
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?



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

kedaman
Feb 3rd, 2001, 06:01 AM
change Height to scaleheight and Width to Scalewidth

YoungBuck
Feb 3rd, 2001, 06:48 AM
Or do the conversions yourself....



Me.Height / Screen.TwipsPerPixelY
Me.Width / Screen.TwipsPerPixelX

picFly.Height / Screen.TwipsPerPixelY
picFly.Width / screen.TwipsPerPixelX

kedaman
Feb 3rd, 2001, 06:59 AM
eh, the height includes titlebar

YoungBuck
Feb 3rd, 2001, 08:33 AM
To get the height of the form minus the TitleBar...



Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Private Const SM_CYCAPTION = 4

'.........
(Me.Height / Screen.TwipsPerPixelY) - GetSystemMetrics(SM_CYCAPTION)
'.......



;)

kedaman
Feb 3rd, 2001, 08:38 AM
Right, and that's gotta be better because it uses api's right? Say shouldn't we stay with ScaleHeight and Scalewidth

YoungBuck
Feb 3rd, 2001, 09:04 AM
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

Sastraxi
Feb 3rd, 2001, 09:38 PM
Make sure that your form's scalemode is 3 - vbPixels

Mobic
Feb 4th, 2001, 03:51 AM
Thanx!

My little problem is no more.. :)