Results 1 to 3 of 3

Thread: Making A Grid On A Frame

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Posts
    55

    Post 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

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. Private Sub Form_Load()
    2.     Me.ScaleMode = vbPixels
    3. End Sub
    4.  
    5. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    6.     Me.Shape1.Left = (X \ 32) * 32
    7.     Me.Shape1.Top = (Y \ 32) * 32
    8. End Sub
    -= a peet post =-

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    hmmm a bit different when moving inside a frame

    VB Code:
    1. Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Me.Shape2.Left = (((X / Screen.TwipsPerPixelX) \ 32) * 32) * Screen.TwipsPerPixelX
    3.     Me.Shape2.Top = (((Y / Screen.TwipsPerPixelY) \ 32) * 32) * Screen.TwipsPerPixelY
    4. End Sub

    the frames scalemode can not be sat to Pixels thus the screen.twipsperpixelX and Y

    -= a peet post =-

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