|
-
Jan 29th, 2002, 09:21 AM
#1
Thread Starter
New Member
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)
-
Jan 29th, 2002, 10:07 AM
#2
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:
Public Sub MoveCenter(obj as SomeObject, x as Long, y as Long)
Dim rx, ry as Long
rx = x - obj.width / 2
ry = y - obj.height / 2
obj.Move(rx, ry)
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|