PDA

Click to See Complete Forum and Search --> : BitBlt : Scroll Image In Picture Box ???


omarswan
Jan 5th, 2000, 04:38 AM
Could someone please give me a good example on how to scroll an image in a picture box using bitblt? Please

------------------
OmarSwan

omarswan@yahoo.com

http://omarswan.da.ru/

"Jesus is Lord"

KENNNY
Jan 5th, 2000, 05:28 AM
well it isnt short, but basically, u load the image into a DC from a file (there are loads of tutorials to do this) Then u blt the part u want into the picbox, so for scrolling, have a loop:

[CODE]
Dim X as long
Dim Paused as boolean

Do While Not Paused = true 'paused is true when user wants to pause scrolling..
X = X + 5 'inc X var so it scrolls
BitBlt pic1.hdc, 0, 0, pic1.width, pic.1height, MyDC, X, 0, VbSrcCopy

if u need more, i can send u some code

KeNNNy



------------------
cintel rules :p
www.cintelsoftware.co.uk

Aaron Young
Jan 7th, 2000, 03:47 AM
You don't necessarily have to use BitBlt, why not use VB's built in functionality and some Imagination?

Add 2 Picturebox's and a Timer to a Form, Picture2 within Picture1, load the Picture to Scroll in Picture2..

Private W As Single

Private Sub Form_Load()
Dim iTemp As Single
W = ScaleX(Picture2.Picture.Width, vbHimetric, vbTwips)
iTemp = Picture1.ScaleWidth
Picture2.BorderStyle = vbBSNone
Picture2.Move 0, 0, W + iTemp
With Picture2
.AutoRedraw = True
.PaintPicture .Picture, W - 10, 0, iTemp, .Height, 0, 0, iTemp, .Height
.Picture = .Image
End With
Timer1.Interval = 100
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Picture2.Left = Picture2.Left - 100
If Picture2.Left < -W Then Picture2.Left = Picture2.Left + W
End Sub


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com



[This message has been edited by Aaron Young (edited 01-07-2000).]

KENNNY
Jan 7th, 2000, 07:26 AM
i know, of course you can do that, and the method is the same as the BitBlt method of scrolling, but Bitblt is *much* faster and flicker-free.

------------------
cintel rules :p
www.cintelsoftware.co.uk