?
Solved

Picture box cls

Posted on 2000-01-25
15
Medium Priority
?
312 Views
Last Modified: 2010-05-02
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?

0
Comment
Question by:crazyman
  • 5
  • 4
  • 3
  • +3
15 Comments
 
LVL 18

Expert Comment

by:deighton
ID: 2384630
do you need .autoredraw = false   ?
0
 
LVL 13

Author Comment

by:crazyman
ID: 2384755
autoredraw is set to true.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2384774
Why don't you use a control array of picture boxes instead of constantly BitBlting on to a larger picture box?

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 18

Expert Comment

by:deighton
ID: 2384825
what happens if picture.autoredraw = false   ?

does it speed things up?

Then it only stores whats on the picture box.
0
 

Expert Comment

by:msn_raju
ID: 2385023
picture1.picture = loadpicture()

it will clear the picture box immediately
0
 
LVL 13

Author Comment

by:crazyman
ID: 2385333
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
 
LVL 10

Expert Comment

by:caraf_g
ID: 2385373
..which brings me back to my previous comment...
0
 
LVL 13

Author Comment

by:crazyman
ID: 2385394
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
 
LVL 10

Expert Comment

by:caraf_g
ID: 2385519
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
 
LVL 18

Expert Comment

by:deighton
ID: 2385721
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
 
LVL 13

Author Comment

by:crazyman
ID: 2385787
God i wouldnt let him see that he's my boss..hehe.
0
 

Expert Comment

by:JimmieToo
ID: 2385803
I'm curious.  Why was raju's answer rejected.  An empty LoadPicture clears the PictureBox instantly?!

Jim
0
 
LVL 13

Author Comment

by:crazyman
ID: 2386576
yes it cleared the picture box but it caused me to get errors "cant create autoredraw image"
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2386806
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
 
LVL 3

Accepted Solution

by:
Lewy earned 50 total points
ID: 2396905
Try using a BitBlt with a dwRop set to cause it to clear.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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

601 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