?
Solved

gradually make a picture width to 0

Posted on 2009-05-06
4
Medium Priority
?
182 Views
Last Modified: 2012-05-06
How can i make a picturebox gradually change the wdith to zero. Like the toolbox window in vb 2008 express ?
0
Comment
Question by:isnoend2001
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 24318683
Either use a Timer and change the width until it gets to zero in the Tick/Elapsed event...

...or use a Loop with DoEvents()Sleep() inside it until the width gets to zero.

Not hard.  What version VB are you working with?
0
 

Author Comment

by:isnoend2001
ID: 24318835
Thanks for your reply
Using vb6
 I tried the timer, but it was kinda jerky, not smooth
Also tried a loop, but it left a black background until it reached 0
I have run out space on the form and need to move some cotrols there.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 24318880
You have to strike a balance to make it smooth...  =\

A very smooth shrink would decrement by 1...but that would most likely take to long.  You just have to experiment with different interval lengths and how much you decrement the width by.  The Loop should work if you have a call to "DoEvents" in there...

0
 

Author Closing Comment

by:isnoend2001
ID: 31578572
Thanks this seems to work pretty good
Private Sub Command2_Click()
Dim i As Long
For i = Me.Picture1.Width To 0 Step -1
Picture1.Width = i
Sleep 0.5
DoEvents
Next i
End Sub

Private Sub Command3_Click()
Dim i As Long
For i = 0 To mPicWidth
Picture1.Width = i
Sleep 0.5
DoEvents
Next i
End Sub
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

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