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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coloring Disappearing 2

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
I have made an application (this is just for fun) which starts out with a colored for with a shape in the middle (a + or x, /, \, -, |, or a dot) then it gets all the coordinates surrounding this shape and randomly colors x of them and then it gets the new surrounding pixel coords and selects x of them to color for x times, which works just great, BUT (there just has to be one hasnt there ;) when something pops up over the form all the coloring disappears.
Now my question is how can I prevent this from happening?

Heres the line I use to color the pixels:

Code:
Form1.Canvas.Pixels[X,Y] := clBlack;

The rest all just getting the coords and randomly selecting X of them to color black.

Any hints or tips are most welcome as I am puzzled to why that is.

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
Great Delphi Websites faq102-5352
 
when something pops up over the form all the coloring disappears. Now my question is how can I prevent this from happening?"

If my memory serves me correctly you have to tie code to the "OnPaint" event of your form to redraw the screen in the event a form is placed over it.
 
And how would I do that? Can you give me a small example please? You mean the line I posted above should be in the OnPaint event?

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
Great Delphi Websites faq102-5352
 
The code you wish to be permanent needs to be called from within the Form1's OnPaint event.

Check this out for more of an explanation:

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Thanks for the info guys! Stars for the both of you!

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
Great Delphi Websites faq102-5352
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top