Solved

gradually make a picture width to 0

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 76
VB 6.0 printer how to align 6 62
Spell Check in VB6 13 112
How to read File Date Created using VB6 8 39
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 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