Problem showing a scrolling bitmap in picturebox 
Author Message
 Problem showing a scrolling bitmap in picturebox

Hi all,

I have a form with 1 picturebox (picposter1) and 1 commandbutton
(cmdscroll).  The picture-size is greater than the height of the picturebox,
width is the same.

Problem:  If I push the 'Scroll'-button, I want the picture to scroll
vertically (up or down) in the picturebox.
When 1 bitmap-row scrolls out of the boundaries from the picturebox, it has
to appear again on the other side.
You can compare this animation like a wheel (reel) from a {*filter*}
slotmachine.
Next step is to have 1 bitmap consisting of several pictures to animate
vertically in the picturebox.

Who can help me out?

__________________________________________________________________ Marco P
ICQ#: 93734549 Current ICQ status: + More ways to contact me
__________________________________________________________________



Sun, 16 Jan 2005 04:17:32 GMT  
 Problem showing a scrolling bitmap in picturebox
Hi,

To get a "looping" movement, easiest is to look at the VB PaintPicture
method or the BitBlt API.
Simply display the bitmap using a Scroll Value which determines where to
start drawing the "top" of the picture.
Fill in the difference with the height starting from the bottom of the
picture.
Note that to do this you will require a source picture and the display
picture.

David
lilchips.com


Quote:
> Hi all,

> I have a form with 1 picturebox (picposter1) and 1 commandbutton
> (cmdscroll).  The picture-size is greater than the height of the
picturebox,
> width is the same.

> Problem:  If I push the 'Scroll'-button, I want the picture to scroll
> vertically (up or down) in the picturebox.
> When 1 bitmap-row scrolls out of the boundaries from the picturebox, it
has
> to appear again on the other side.
> You can compare this animation like a wheel (reel) from a {*filter*}
> slotmachine.
> Next step is to have 1 bitmap consisting of several pictures to animate
> vertically in the picturebox.

> Who can help me out?

> __________________________________________________________________ Marco P
> ICQ#: 93734549 Current ICQ status: + More ways to contact me
> __________________________________________________________________



Sun, 16 Jan 2005 04:43:04 GMT  
 Problem showing a scrolling bitmap in picturebox
Thanks for your reply,

I did find several references about the use, but no practical examples, so I
don't know how to start my program.
I'm convinced that it can be done without too many code, but I don't know
where to start to achieve this.

It's so much easier to do it with plain text, but with bitmaps that's
another story.
I also don't understand why I need a source picture and display picture.

Sorry for my bad english written sentences, I'm from Belgium.

Can you make a simple example so I can adjust it to my needs, so I can get
started?

Thanks in advance for helping me so far.



Quote:
> Hi,

> To get a "looping" movement, easiest is to look at the VB PaintPicture
> method or the BitBlt API.
> Simply display the bitmap using a Scroll Value which determines where to
> start drawing the "top" of the picture.
> Fill in the difference with the height starting from the bottom of the
> picture.
> Note that to do this you will require a source picture and the display
> picture.

> David
> lilchips.com



> > Hi all,

> > I have a form with 1 picturebox (picposter1) and 1 commandbutton
> > (cmdscroll).  The picture-size is greater than the height of the
> picturebox,
> > width is the same.

> > Problem:  If I push the 'Scroll'-button, I want the picture to scroll
> > vertically (up or down) in the picturebox.
> > When 1 bitmap-row scrolls out of the boundaries from the picturebox, it
> has
> > to appear again on the other side.
> > You can compare this animation like a wheel (reel) from a {*filter*}
> > slotmachine.
> > Next step is to have 1 bitmap consisting of several pictures to animate
> > vertically in the picturebox.

> > Who can help me out?

> > __________________________________________________________________ Marco
P
> > ICQ#: 93734549 Current ICQ status: + More ways to contact me
> > __________________________________________________________________



Sun, 16 Jan 2005 06:02:16 GMT  
 Problem showing a scrolling bitmap in picturebox
Hi,

Create a new VB Project...
Put two PictureBoxes, one Timer, and one Command Button on the Form...
Set their properties as:
  Picture1.ScaleMode = 3 - Pixel
  Picture1.Width = 480
  Picture2.ScaleMode = 3 - Pixel
  Picture2.Width = 480
  Timer1.Enabled = False
  Timer1.Interval = 50
Assign any 32x32 Icon or Bitmap to Picture1's Picture property.

Add this code to the appropriate Control's events:

  Option Explicit

  Private lTop As Long  'scrolling top coordinate

  Private Sub Command1_Click()

      Timer1.Enabled = True

  End Sub

  Private Sub Timer1_Timer()

      'copy image, starting at top coordinate, scrolling it downward
      ' dest x1, y1, w, h, src x2, y2, w, h
      Picture2.PaintPicture Picture1.Picture, 0, lTop, 32, 32 - lTop, 0, 0,
32, 32 - lTop

      'copy remainder of image to fill in space at top of destination
picturebox
      If lTop > 0 Then
        Picture2.PaintPicture Picture1.Picture, 0, 0, 32, lTop, 0, 32 -
lTop, 32, lTop
      End If

      'adjust top coordinate, causing 1 pixel scroll down
      lTop = lTop + 1
      If lTop = 32 Then lTop = 0

  End Sub

Run the program, click on the Command Button, and watch the Icon loop
around.

You can optionally set Picture1.Visible = False to hide the source image
Control.
The reason why this method uses two PictureBoxes, is because we are clipping
portions out of the Source Picture to the Destination Picture.
Note that you could just as easily load a Picture into the Source PictureBox
at run-time, or use an StdPicture Object instead of a PictureBox Control, or
use API calls and keep the source Picture in memory instead of using a
Control.

David
lilchips.com


Quote:
> Thanks for your reply,

> I did find several references about the use, but no practical examples, so
I
> don't know how to start my program.
> I'm convinced that it can be done without too many code, but I don't know
> where to start to achieve this.

> It's so much easier to do it with plain text, but with bitmaps that's
> another story.
> I also don't understand why I need a source picture and display picture.

> Sorry for my bad english written sentences, I'm from Belgium.

> Can you make a simple example so I can adjust it to my needs, so I can get
> started?

> Thanks in advance for helping me so far.



> > Hi,

> > To get a "looping" movement, easiest is to look at the VB PaintPicture
> > method or the BitBlt API.
> > Simply display the bitmap using a Scroll Value which determines where to
> > start drawing the "top" of the picture.
> > Fill in the difference with the height starting from the bottom of the
> > picture.
> > Note that to do this you will require a source picture and the display
> > picture.

> > David
> > lilchips.com



> > > Hi all,

> > > I have a form with 1 picturebox (picposter1) and 1 commandbutton
> > > (cmdscroll).  The picture-size is greater than the height of the
> > picturebox,
> > > width is the same.

> > > Problem:  If I push the 'Scroll'-button, I want the picture to scroll
> > > vertically (up or down) in the picturebox.
> > > When 1 bitmap-row scrolls out of the boundaries from the picturebox,
it
> > has
> > > to appear again on the other side.
> > > You can compare this animation like a wheel (reel) from a {*filter*}
> > > slotmachine.
> > > Next step is to have 1 bitmap consisting of several pictures to
animate
> > > vertically in the picturebox.

> > > Who can help me out?

> > > __________________________________________________________________
Marco
> P
> > > ICQ#: 93734549 Current ICQ status: + More ways to contact me
> > > __________________________________________________________________



Sun, 16 Jan 2005 02:24:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Howto scroll a bitmap horizontally in a picturebox?

2. Scrolling a Large Bitmap in a picturebox

3. Loading Bitmap into PictureBox

4. function that allows you to combine 2 bitmap images into one picturebox

5. Load several bitmap and line up in a row in picturebox

6. move bitmap buffer to picturebox?

7. Exporting several pictureboxes as 1 bitmap

8. Brightness control of bitmap in picturebox

9. Creating Bitmap files from pictureboxes

10. How to turn Picturebox into BITMAP?

11. Using StretchBlt to Stretch a Bitmap/Icon in a PictureBox

12. Modifying bitmap loaded in pictureBox

 

 
Powered by phpBB® Forum Software