Picture box cls

Hi,
  I have a messaging application that has the pictures of all logged on users and various options on each user.
The pictures are bitblt 'ed onto a larger picture box along with a label that has status ,logged on for ..etc..

The problem that im having is actually when i come to refresh the view to update any status changes,when i call the cls method of the picture box it can take anywhere from 5 to 10 seconds to execute that 1 line of code.

Any ideas how to clear a picture box fast?

LVL 13
crazymanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

deightonprogCommented:
do you need .autoredraw = false   ?
0
crazymanAuthor Commented:
autoredraw is set to true.
0
caraf_gCommented:
Why don't you use a control array of picture boxes instead of constantly BitBlting on to a larger picture box?

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

deightonprogCommented:
what happens if picture.autoredraw = false   ?

does it speed things up?

Then it only stores whats on the picture box.
0
msn_rajuCommented:
picture1.picture = loadpicture()

it will clear the picture box immediately
0
crazymanAuthor Commented:
I need the autoredraw set to true because the Picture box is populated by
a long and fairly complex function that takes a few seconds and i dont want to have to keep calling this.
Picture1.picture=loadpicture() causes me to get the error "cant create autoredraw image" when i then try to draw a simple line on the picture box.
0
caraf_gCommented:
..which brings me back to my previous comment...
0
crazymanAuthor Commented:
Well i have been told im not allowed to use multiple picture boxes as there may be around 60-70 pictures that all need refreshing and moving around according to form resizes, i guess that would be a soloution but i have been abrubtley told that i cannot use more than one picture box.
0
caraf_gCommented:
OK, I'll bite. What idiot told you that? <g> I'd like to see him or her participate on this thread now and explain themselves.
0
deightonprogCommented:
Control array with just two pictures

Private Sub Command1_Click()

Load picture1(1)
picture1(0).Visible = False
picture1(1).Visible = True
picture1(1).Picture = LoadPicture("d:\vb4\bitmaps\assorted\balloon.bmp")

End Sub

then to clear it#

Private Sub Command2_Click()
Unload picture1(1)
End Sub

then load it in again





0
crazymanAuthor Commented:
God i wouldnt let him see that he's my boss..hehe.
0
JimmieTooCommented:
I'm curious.  Why was raju's answer rejected.  An empty LoadPicture clears the PictureBox instantly?!

Jim
0
crazymanAuthor Commented:
yes it cleared the picture box but it caused me to get errors "cant create autoredraw image"
0
caraf_gCommented:
Hey crazyman, don't worry about it. It is *I* who is calling him/her an idiot, not you! ;-)

And trust me, he/she *is* an idiot.

<end of deliberately provocative statement>
0
LewyCommented:
Try using a BitBlt with a dwRop set to cause it to clear.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.