Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Picturebox flickering wen moving 1

Status
Not open for further replies.

Niphyr

Programmer
Jul 21, 2003
85
0
0
AU
I have made a game, where picture boxes move about the screen. No matter what i try, (changing autoredraw, increasing/decreasing timer intervals and the distance they move) it keeps on flickering, any ideas on how to stop it flickering or even a better way or doing the graphics (preferebly a wat to stop the flickering so i dont have to re-write the code)

Thanks

-Niphyr

------------------------------
------------------------------
 
go to and learn to use the bitblt functions. they are verry good.

After that you can learn directX for Visual basic wich is even more powerfull.

Do not spend your time getting rid of flickering. Just learn to use the stuff that is made for it.

mvg
Roel
 
Thanks both, ill have a look at both on the weekend when i get back to my PC.

-Niphyr

------------------------------
------------------------------
 
I suggest you learn Direct Draw. I have actually made 6 games in Visual Basic by moving images, then I eventually switched to using image lists an the draw function, and later to the PaintPicture function, and now I am using DirectDraw. It is very fast and worth learning. I have all the ways of doing graphics I know described on this page:

 
OK, i've looked at bitblt, but cant seem to work out how to get it to work, the examples on MSDN are too confusing and all other examples i've found are for complicated things, not the basics. If i have a picture that is 20x20 pixels and i want it to appear on my form at the coordinates (the top left corner) (30, 40) pixels. How would i do that? could someone PLEASE give me an example as i have looked everywhere and cant see to understand it :(

Thankyou, i hope!

-Niphyr

------------------------------
------------------------------
 
Declare te function BitBlt. sorry this can't be more easy'er becouse it is alway's like this.

Declare Function BitBlt Lib "gdi32" Alias "BitBlt" _
(ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long

Put a picture control on your form and make it not visable.
Put a picture in it with load picture our so.

then add line of code (in form load for example)

BitBlt Me.hDC, 0, 0, picbox.ScaleWidth, _
picbox.ScaleHeight, picbox.hDC, 0, 0, vbSrcCopy


explenation.
Me.hDC = where do I need to put my picture on (the form)
0, 0 = top and left coordinates.
picbox.ScaleWidth, picbox.ScaleHeight = what is the size of the picture in width and height. Or How much space do I need to reserve for the picture. (here it is just the size of the picbox)
picbox.hDC = the source. (This object contains the picture.)
0,0 = from where do I need to start drawing the picture.
(here we say from top 0, left 0 so the full pic will be drawn.)

hope this helps.



tank you,

(>" "<)
(='o'=)
-(,,)-(,,)-----
|LORD_GARFIELD|
---------------
 
Cool. thankyou it works great atm, ill try applying it and get back to you, thanks again Garfield.

-Niphyr

------------------------------
------------------------------
 
no problem. That's the meaning of this forum. Helping and get helped. :)

tank you,

(>" "<)
(='o'=)
-(,,)-(,,)------------------------------
LORD_GARFIELD
---------------------------------------
 
It took a while, but i think ive now got the hang of the whole bitblt thing. Thanks all for help, especially LordGarfield for the example.

-Niphyr

------------------------------
------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top