Solved

Unroll and Image

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

689 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