Board index » delphi » Drawing to screen and then clear drawing???

Drawing to screen and then clear drawing???

What about using the FillRect method to blank the text area?

Oliver Handle <webmas...@cycom.at> skrev i en
nyhedsmeddelelse:7r6cls$91...@news.netway.at...

Quote
> Thing is: I want to write a text onto the screen and then quickly delete
it
> without the whole screen to refresh.

 

Re:Drawing to screen and then clear drawing???


I dont think that will work, because I dont have a blank background but
any window that lies behind it. So there can be everything behind my text.
So I search a way to realy refresh the background without flickering.

Thanks

Oliver

Finn Tolderlund <XnojunkmailXf...@teliamail.dkXnojunkmailX> schrieb in im
Newsbeitrag: 7r6e5h$im...@news101.telia.com...

Quote
> What about using the FillRect method to blank the text area?

> Oliver Handle <webmas...@cycom.at> skrev i en
> nyhedsmeddelelse:7r6cls$91...@news.netway.at...
> > Thing is: I want to write a text onto the screen and then quickly delete
> it
> > without the whole screen to refresh.

Re:Drawing to screen and then clear drawing???


Errr...I'm not exactly sure what' you're trying to accomplish but...

If your writing a game: Use DirectX and the DX components.

If your writing an applicaiton:  Use a TMemo and use Lines.Add and
Lines.Clear methods.

Quote
Oliver Handle <webmas...@cycom.at> wrote in message

news:7r6cls$919$1@news.netway.at...
Quote
> Hi there!

> Once again I have a problem I cant solve. I tried nearly everything I
think
> is possible, with little success.

> Thing is: I want to write a text onto the screen and then quickly delete
it
> without the whole screen to refresh.
> (in an earlier state of work I saved the background to a bmp and then
> restored it -> if someone scrolls a window it happens to draw the bk bmp
> where it shouldnt be anymore)
> Tried RedrawWindow, InvalidateRect, .... but all it does is either nothing
> or refreshing the whole screen with losts of flickering.
> I tried the following:
> InvalidateRect(0, @TextRect, false); -> flickering (olthough I define a
> small rect ?!?)
> RedrawWindow(0, @TextRect, 0, RDW_ERASE+RDW_INVALIDATE); -> nothing
happens
> (?!?)
> (cominations of the two and combinations of params included!)

> Please help me out if you can ...

> Oliver

Re:Drawing to screen and then clear drawing???


Hi there!

Thank you for your answers.
But I think I describe the problem again.I work for a psychologist. He has
an idea for therapy to put subliminal messages into the screen.
So I need to quickly draw a text directly into the "screenbuffer" and then
after about 5 ms I have to delete this text.
This should be so quick that the user doesnt recognize it and should not
flicker, because this is drawn every 5 seconds.

Heres a piece of my code which should guide you to what I want:

 ScreenHandle := GetDC(0); // get desktop screen
 ScreenCanvas := TCanvas.Create; ScreenCanvas.Handle := ScreenHandle;
 ScreenCanvas.Font := TextFont; ScreenCanvas.Brush.Style := bsClear;
 TextSizeBuffer := ScreenCanvas.TextExtent(TextBuffer);
 TextRect.Top := Screen.Height div 2 - (TextSizeBuffer.cy div 2);
 TextRect.Left := Screen.Width div 2 - (TextSizeBuffer.cx div 2);
 TextRect.Bottom := TextRect.Top + TextSizeBuffer.cy;
 TextRect.Right := TextRect.Left + TextSizeBuffer.cx;
 ScreenCanvas.TextOut(TextRect.Left, TextRect.Top, TextBuffer); // show text
 sleep(5);
 RedrawWindow(0, @TextRect, 0, RDW_ERASE+RDW_INVALIDATE); // hide it

The main problem is to clear the text after it was visible. (this code
doesnt clear it althought I refresh the screen!)
I cant use fillrect to clear the text because the background can be
everything (desktop, some appwindows, tv-app,...) and so is not white or
black.

please help me out :)
Robert Dytmire <rdytm...@innovativesearch.com> schrieb in im Newsbeitrag:
G2NB3.4$lX4.272@client...

Quote
> Errr...I'm not exactly sure what' you're trying to accomplish but...

> If your writing a game: Use DirectX and the DX components.

> If your writing an applicaiton:  Use a TMemo and use Lines.Add and
> Lines.Clear methods.

> Oliver Handle <webmas...@cycom.at> wrote in message
> news:7r6cls$919$1@news.netway.at...
> > Hi there!

> > Once again I have a problem I cant solve. I tried nearly everything I
> think
> > is possible, with little success.

> > Thing is: I want to write a text onto the screen and then quickly delete
> it
> > without the whole screen to refresh.
> > (in an earlier state of work I saved the background to a bmp and then
> > restored it -> if someone scrolls a window it happens to draw the bk bmp
> > where it shouldnt be anymore)
> > Tried RedrawWindow, InvalidateRect, .... but all it does is either
nothing
> > or refreshing the whole screen with losts of flickering.
> > I tried the following:
> > InvalidateRect(0, @TextRect, false); -> flickering (olthough I define a
> > small rect ?!?)
> > RedrawWindow(0, @TextRect, 0, RDW_ERASE+RDW_INVALIDATE); -> nothing
> happens
> > (?!?)
> > (cominations of the two and combinations of params included!)

> > Please help me out if you can ...

> > Oliver

Other Threads