|
-
Nov 13th, 2001, 07:43 AM
#1
Thread Starter
New Member
Moving a shape
Ok I am new to vb and i am struggling trying to get a shape object to move across the screen.
So far i have made a timer that makes a label count up, but i cannot get the shape to move to it, this is the current code:
Code:
Private Sub Timer1_timer()
Shape1.move (label1.caption)
Label1.caption = Str(Val(Label1.caption) + Val(1))
End Sub
Any ideas?? If there is a better way of doing it then trhis would be good
Cheers...
-
Nov 13th, 2001, 08:26 AM
#2
Good Ol' Platypus
Try setting Me.ScaleMode = 3 first, but not in the Timer routine; set it in the form view. Anyways, you could use this: Shape1.Left = Val(Label1.Caption), or Shape1.Top if you would like to move down.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Nov 13th, 2001, 04:00 PM
#3
Hy, I also started using shapes, that moved around. But soon you wil find that they start to flicker. consider to use the 'old' line and circle methods to paint a new picture in each timer-cycle
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Nov 13th, 2001, 04:12 PM
#4
Hyperactive Member
Try using the TOP and LEFT properties. If you want it to move up, subtract it's TOP property, or down add it. Same for the left. Subtract the value to get it to go the direction it's named as. (There are no RIGHT and DOWN properties, they're part of the same thing, think of LEFT and TOP and X, Y)
VB Code:
Private Sub Timer1_Timer()
Shape.Top = Shape.Top - 10
End Sub
-
Nov 13th, 2001, 04:50 PM
#5
So Unbanned
Instead of using a label you may want to use a Public/Private or Static varible.
Also you're using twips, usually 15 twips=1 pixel but you can use screen.twipsperpixelx/y.
For any intensive purpose though you'd want to set the scale of your form(or picturebox) to pixels(3).
-
Nov 14th, 2001, 08:26 AM
#6
Hyperactive Member
I thought twips are bigger than pixels. A twip is 1/1440th of an inch. And a the number of pixels on your monitor is determined by you resolution too.
-
Nov 19th, 2001, 04:34 AM
#7
Thread Starter
New Member
Cheers all this helps loads.
-
Nov 19th, 2001, 08:35 AM
#8
Good Ol' Platypus
VB Code:
PixelX = TwipX / Screen.TwipsPerPixelX
PixelY = TwipY / Screen.TwipsPerPixelY
That's how you convert.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|