Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

gradually make a picture width to 0

Posted on 2009-05-06
4
Medium Priority
?
180 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
[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
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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

618 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