Results 1 to 2 of 2

Thread: Moving pictures/icons

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Hampshire, England, UK
    Posts
    1

    Moving pictures/icons

    I'm brand new to VB and only a novice at programming.

    I'm trying to move pictures/images using the object.Move command but the object is placed with the top left hand corner at the x,y coord Is there some easy way to put the centre of the object on this position (without having to go through some intricate procedure of counting the twips size of the picture, dividing by 2, adding/subtracting from chosen position etc, etc)
    Madmiral

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You'll soon learn what complicated really means.

    Note that all names/functions I use are guesses, I don't know VB. But it should help you to understand the mechanism.
    VB Code:
    1. Public Sub MoveCenter(obj as SomeObject, x as Long, y as Long)
    2.   Dim rx, ry as Long
    3.   rx = x - obj.width / 2
    4.   ry = y - obj.height / 2
    5.   obj.Move(rx, ry)
    6. End Sub
    As I said, guesses. I assume that Move wants absolute coordinates.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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