Unroll and Image

Posted on 1998-05-18
Last Modified: 2012-06-27
Hi, I am using VB5 (SP3) under NT and 95.  I want to give the appearance of an image "unrolling" that is, the image appears partly on the left (or whatever side) and then 'opens' to the right, like unrolling a roll of paper or something.  I do not care what control I use (ie: Picture or Image), any ideas?

Thanks in advance.
Question by:oreg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Accepted Solution

clifABB earned 190 total points
ID: 1453289
To unroll to right:
Use a picturebox

Set the autoredraw property = True
Set Width = 0
Add the picture

Public Sub UnrollToRight(picTarget As PictureBox, fWidth As Single)
  Dim fCnt1 As Single
  Dim fTimer As Single

  fTimer = Timer + 10
  For fCnt1 = 0 To fWidth
    Do Until Timer > fTimer
    picTarget.Width = fCnt1
    fTimer = Timer + 10
  Next fCnt1
End Sub

Call using this code:
  Unroll Picture1, 3015 'Or whatever width it will end up.

Expert Comment

ID: 1453290
I have improved it a bit (and added a rollup as well):
Set the picture controls visible property = false

Public Sub RollupFromRight(picTarget As PictureBox)
  Dim fCnt1 As Single
  Dim fWidth As Single
  fWidth = picTarget.Width
  For fCnt1 = fWidth To 0 Step -5
    picTarget.Width = fCnt1
  Next fCnt1
  picTarget.Visible = False
End Sub
Public Sub UnrollToRight(picTarget As PictureBox, fWidth As Single)
  Dim fCnt1 As Single
  Dim fTimer As Single

  picTarget.Visible = True
  For fCnt1 = 0 To fWidth Step 5
    picTarget.Width = fCnt1
  Next fCnt1
End Sub

This will call it:
  If Picture1.Visible Then
    RollupFromRight Picture1
    UnrollToRight Picture1, 3615
  End If


Expert Comment

ID: 1453291
This is pretty good, it does the job but is awefully slow on any non-trivial image, I managed to speed it up by only calling .refresh so often, so it works pretty nicely.  Thanks, if you figure any other neat tricks feel free to post them :)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question