|
-
Feb 8th, 2001, 01:31 PM
#1
Hi,
I'm using a PictureBox with lots of Lines,Circles, Shapes and Label. Each of them is moved around, with an increased number and updaterate they start flickering. Is theier anything I can do against that? and whow?
Thanks
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Feb 8th, 2001, 02:01 PM
#2
if you set the picturebox's "AutoRedraw" property to "True" it will eliminate the flickering... it is VERY slow, however, but i can post faster code later, if anyone wants it.
-
Feb 8th, 2001, 02:08 PM
#3
The faster thing
Ok, heres some psudo code for drawing faster, without autoredraw....
youll need to add the LockWindowUpdate API function to your form (use the API viewer)... then use this formula...
Code:
do while true
picture1.cls
lockwindowupdate 0
'do your drawing stuff
lockwindowupdate picture1.hwnd
doevents
loop
-
Feb 9th, 2001, 08:48 AM
#4
Another faster method is to double buffer the drawing - draw onto a device context in memory first, then 'flip' the entire image onto the picture box. Smooth as a babys bum.
- gaffa
-
Feb 9th, 2001, 04:05 PM
#5
Thanks,but:
Zaei: Your code does somethig, but their must be a mistake in it, 'cause the picture stays fixed?? Although the other parts of the forms have a new flickering if I use that function??
gaffa: I was thinking about something like that, the whow is my problem, I did something like that with old QBX, but I think it does not work for Shape- and Line-Objects. Do you some more specific help?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Feb 13th, 2001, 04:53 PM
#6
Good Ol' Platypus
I think the 'do while true' line in Zaei's code is wrong. Correct me if im wrong, but by default everything is zero, zero=false so it will never happen?
Use do while Drawing=True and make drawing a boolean you can set to true to draw and false not to draw
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 13th, 2001, 05:29 PM
#7
its not wrong, its just a horrible programming style =)
the way it works is a do while loop will continue UNTIL
the condition is false. so, when you say "Do While
True" True can NEVER be False, so it will just loop
continuously. As a side effect, if you try to close the
window the regular way (the "X" button) the form will
actually re-load itself, and the only way to stop it is to
use that stop button in VB. Never do it the way i did it
=)
-
Feb 13th, 2001, 05:54 PM
#8
Good Ol' Platypus
In this case, what is the variable? Are you using a with statement or something? What am I missing????
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 18th, 2001, 10:14 PM
#9
there is no variable, its a Value. Enter More Theory:
Whenever you do a comparison, it will return a boolean
value. This can save lines and lines of coding, if, for
example, you needed to assign "True" or "False" to a
variable. You could do it this way:
Code:
If X > Y Then
Z = True
Else
Z = False
End If
But, a MUCH better way to do it is this:
So, any comparison that you do returns a boolean
variable. This goes for While loops as well. Example:
Code:
Do While X > Y
'Do Some Stuff
Loop
WHen our program hits this block of code, it checks our
statement. If X started off being less than Y, the code
would never execute, because X > Y returns "False".
Basically, all I did in the Do While True loop, is, instead
of passing a statement (X = X, for example) i saved
myself typing time by just passing the value "True".
I hope that sheds some light on this stuff =).
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
|