Results 1 to 4 of 4

Thread: BitBlt : Scroll Image In Picture Box ???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Post

    Could someone please give me a good example on how to scroll an image in a picture box using bitblt? Please

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

    [email protected]

    http://omarswan.da.ru/


    "Jesus is Lord"

  2. #2
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    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
    www.cintelsoftware.co.uk

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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..
    Code:
    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
    [email protected]
    [email protected]



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

  4. #4
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    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
    www.cintelsoftware.co.uk

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