Solved

gradually make a picture width to 0

Posted on 2009-05-06
4
172 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 85

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 85

Accepted Solution

by:
Mike Tomlinson earned 500 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now