|
-
Dec 30th, 2002, 08:20 PM
#1
Thread Starter
Member
Making A Grid On A Frame
How do I make a shape in a frame move when the mouse moves, but snaps to a grid. (every 32*32)
Thanks for any help, greatly appreciated

- Sk
-
Dec 31st, 2002, 12:55 AM
#2
-= B u g S l a y e r =-
VB Code:
Private Sub Form_Load()
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Shape1.Left = (X \ 32) * 32
Me.Shape1.Top = (Y \ 32) * 32
End Sub
-
Dec 31st, 2002, 01:11 AM
#3
-= B u g S l a y e r =-
hmmm a bit different when moving inside a frame
VB Code:
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Shape2.Left = (((X / Screen.TwipsPerPixelX) \ 32) * 32) * Screen.TwipsPerPixelX
Me.Shape2.Top = (((Y / Screen.TwipsPerPixelY) \ 32) * 32) * Screen.TwipsPerPixelY
End Sub
the frames scalemode can not be sat to Pixels thus the screen.twipsperpixelX and Y
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|