Solved

Unroll and Image

Posted on 1998-05-18
3
142 Views
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.
0
Comment
Question by:oreg
  • 3
3 Comments
 
LVL 6

Accepted Solution

by:
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
      DoEvents
    Loop
    picTarget.Width = fCnt1
    fTimer = Timer + 10
  Next fCnt1
End Sub

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

Expert Comment

by:clifABB
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
    picTarget.Parent.Refresh
  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
    picTarget.Refresh
  Next fCnt1
End Sub


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

0
 
LVL 6

Expert Comment

by:clifABB
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 :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now