?
Solved

gradually make a picture width to 0

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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.
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…
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…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 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