?
Solved

Unroll and Image

Posted on 1998-05-18
3
Medium Priority
?
160 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
[X]
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
3 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 760 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

801 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