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
Solved

Unroll and Image

Posted on 1998-05-18
3
148 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

840 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