Clear problem

Izac_boy9
06-27-2006, 12:52 PM
Hi!

I have a picture box which i am drawing on. Here's the code i am using:

Private sub timer_tick

Picture1.creategraphics.clear(Color.white)

for i = 1 to 999
Picture1.creategraphics.drawstring( i ,font, brushes.black , i * 25 - SCROLLBAR.value , 0 )
next i

End sub


The problem is when the screen clears white, you can see flashes of white.

Is there anyway to fix this? i remember it never done this in vb6.

Any help would be great thanks!

P.S:The code might not be EXACLY right, becuase i am not at vb.net at the moment. but you should be able to understand it.

JNewt
06-28-2006, 09:02 AM
The flashing is most likely a result of all the overhead you've got going there. Every time that timer ticks, you're calling CreateGraphics about 1000 times. So I recommend 2 things: 1) write a better organized (and more proper) sub (check out this site for info on better ways to do this stuff: http://www.bobpowell.net/faqmain.htm) and 2) learn about double buffering.

Izac_boy9
06-28-2006, 10:48 AM
This never happened in vb6 and i used toput it throught more than 8000 drawing function :huh:

JNewt
06-28-2006, 04:13 PM
Well, you can get performance similar to VB6 out of .Net-- just not the way you're doing it. The suggestions in my earlier post will help you find the proper way of doing things.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum