I'm trying to scroll up and down some images when I push a button
the images not scroll clearly
any suggestion?Code:For X = 1 To 3
fimg(X).Top = fimg(X).Top - 1
Next X
Printable View
I'm trying to scroll up and down some images when I push a button
the images not scroll clearly
any suggestion?Code:For X = 1 To 3
fimg(X).Top = fimg(X).Top - 1
Next X
I'd suggest you reference a timer(clock) to move your images.
That way you can determine where an image ought to be at a given time, and your program's performance can adapt to the system(like a frame skip).
VB's built-in Timer function is probably good enough for this.
Also keep in mind the control's parent/container ScaleMode property. If the control is on a form and form's ScaleMode is Twips, simply subtracting 1 has little effect.
Can you give me a sample?
I tried to subtract 20 twips
it scrolled faster but not clearly
Here's an example project I've made to show you how to use a timer control along with a couple UDTs to handle moving an object according to a start/end location and time scale(seconds).
If you have any problems with the code just post a reply.
Add a timer, named: tMain; set the interval to 10, or more
Add a Label(or Image control, or Picture, etc.), named: lPic, or rename it to your control
vb Code:
Private Type sngPoints X As Single Y As Single End Type Private Type tAnimate StartTime As Single EndTime As Single StartLoc As sngPoints EndLoc As sngPoints End Type Private animImage As tAnimate Private Sub Form_Load() Randomize End Sub Private Sub tMain_Timer() Dim ElapsedPercent As Single With animImage If Timer > animImage.EndTime Then .StartTime = Timer .EndTime = Timer + 3 * Rnd .StartLoc.X = lPic.Left .StartLoc.Y = lPic.Top .EndLoc.X = ScaleWidth * Rnd .EndLoc.Y = ScaleHeight * Rnd End If ElapsedPercent = (Timer - .StartTime) / (.EndTime - .StartTime) lPic.Move .StartLoc.X + (.EndLoc.X - .StartLoc.X) * ElapsedPercent, _ .StartLoc.Y + (.EndLoc.Y - .StartLoc.Y) * ElapsedPercent End With End Sub
This example moves the control around the form randomly.
If all images always scroll the same amount and are next to each other, you could use a single container control such as a borderless Frame and move that single control. All the children remain in the same position, only the container needs to move.
Also, setting ScaleMode to vbPixels for the container's parent control (such as a Form or a PictureBox) will make moving by 1 more visible. One twip (the default unit for ScaleMode) is 1/15 of a pixel (ie. 15 twips = 1 pixel). Scrolling by 1 pixel may be slow though, if you need more speed then you want to move by larger values.
thanks
but there is no possible to download the attached filed
thanks merri
that's works great
thanks firextol