Hi all,
I have a ball bouncing around the screen for a laugh. The trouble is, it flickers quite a lot :eek: Is there a method of moving things about the screen without any flicker?
Cheers :D
Printable View
Hi all,
I have a ball bouncing around the screen for a laugh. The trouble is, it flickers quite a lot :eek: Is there a method of moving things about the screen without any flicker?
Cheers :D
You can us C++ if you want to try these kinds of a GDI stuff
Set AutoRedraw to True.
Z.
Hypnos ...
You basically need to do a "backbuffer" technique to make things more visually smooth using VB ...
So, if you are drawing your ball using VB's built-in .PaintPicture or .Circle methods, then you should have a hidden PictureBox the size of your displayed surface (on-screen Form or PictureBox) ... then you do something like:
1> Clear your picBackBuffer (hidden picture box) with something like picBackBuffer.Cls or picBackBuffer.Picture = LoadPicture()
2> Draw everything onto your picBackBuffer
3> Transfer everything to the displayed surface with something like picViewPort.Picture = picBackBuffer.Image
You'll want to make sure your picture boxes have .AutoRedraw = True, and .ScaleMode = 3-pixel to make things work better.
Then ... if you want to improve things, you can learn to use Memory-based DC's and the GDI's bitblt. Here's a good starter tutorial: www.vbexplorer.com/show.asp?id=188
Hope that helps ...
-Bryk
Edit: Bryk ... Hypnos -- I just went out to your website ... and, :o sorry for my over-simplified response. From the question, seemed the usual never-did-graphics-before type question ... but you obviously have ... so, do with it what you will.:rolleyes:
Thanks guys. I just don't like the idea of using an off screen picture box, it seems like a lame and unprofessional way of doing it. Surely there's another way?
You can load files directly into memory using offscreen DCs. They are like the .hDC property of pictureboxes and forms.
Hypnos ... Check out my original post ...:pQuote:
Originally posted by hypnos
Thanks guys. I just don't like the idea of using an off screen picture box, it seems like a lame and unprofessional way of doing it. Surely there's another way?
Except that I should have given you the link to this tutorial instead: www.vbexplorer.com/show.asp?id=189 ... it's the "Part 2" of the series, and Memory-based DC's are discussed toward the bottom of the page.Quote:
Then ... if you want to improve things, you can learn to use Memory-based DC's and the GDI's bitblt. Here's a good starter tutorial: www.vbexplorer.com/show.asp?id=188
-Bryk
I believe Fox has a tutorial on them, it didn't work for me though.
And again, as my post said, you can set AutoRedraw to True.
Does anyone even read what i write?
Z.
I did:D:p
I read it, Z ... but sometimes things still flicker, if you're doing the screen-clearing/drawing combo directly to the displayed object, even with .AutoRedraw=True ...Quote:
Originally posted by Zaei
And again, as my post said, you can set AutoRedraw to True.
Does anyone even read what i write?
Z.
-Bryk
depends where you're blitting at, if that's even what the case is :pQuote:
if you're doing the screen-clearing/drawing combo directly to the displayed object, even with .AutoRedraw=True ...