|
-
Sep 3rd, 2001, 08:11 AM
#1
Thread Starter
New Member
Can't create AutoRedraw Image
There is a problem i face when drawing lines on picture box.
I have been using this line of code extensively in my forms to draw the lines.
/*code*/
frmname.Line (x1, y1)-(X2, Y2), rgbColor
/*code*/
It has been working fine for me for quite some time.
But now the number of lines drawn and redrawn is so great that it has started throwing an error
Can't create AutoRedraw Image.
And it fails to draw the lines.
-
Sep 3rd, 2001, 12:03 PM
#2
Frenzied Member
I'm pretty sure this error is caused when you are running low on
GDI resources. It is difficult from this disatance to say why you
are running low. It can be caused by having too many windows
open that are performing graphics routines, or if graphics
routines are not "cleaning up after themselves"
From the Start menu select Accessories/System Tools/Resource
Monitor and have it runnning when you are running your app.
Check the monitor before you start your app and when you get
the error check the monitor again.
If you have a lot of tight loops in conjection with graphics
routines this could be a cause. Try peppering your code with a
few Doevents.
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Sep 3rd, 2001, 11:00 PM
#3
Thread Starter
New Member
Thanks for the suggestion.
Even i get the feeling that there are so many loops in the program.
My project requirement is like this -
i need to display the hierarchies in an organization.These require so many lines to display the flow chart.
How do i use DoEvents ??? in my code.
What does it do ??
Thanks in advance.
-
Sep 4th, 2001, 12:19 AM
#4
Frenzied Member
Maybe you've notices at times when your program is churning away that it becomes unresponsize. If you add some Doevents it frees up the CPU to proccess other things like mouse clicks, drawing graphics, and what not. To use doevents you just put it in a loop like this.
VB Code:
For k = 1 to 500
lCounter = lCounter + 1
Doevents
Next
You don't always have to call Doevents each itereation of the loop. Each time you call it it will slow your program down every so slightly. You can do something like this.
VB Code:
'Only call doevents every 100 loops
For k = 1 to 500
lCounter = lCounter + 1
If lCounter Mod 100 = 0 then
Doevents
End If
Next
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|