No announcement yet.

Erasing the screen

  • Filter
  • Time
  • Show
Clear All
new posts

    Erasing the screen

    I have a program were I have to erace a little place on
    the screen. I thought InvalidateRgn would work but it
    doesn't (At least it doesn't work on the text that is
    made using DrawText). How can I erace it? And one more
    question. How can I change the size for the text drawn
    by DrawText? Curtis

    Calling InvalidateRect() should trigger a subsequent WM_PAINT message (when the current thread message queue is empty), and in is in that handler that you should use FillRect() or some similar drawing function to draw in the target rectangle, thus clearing it.

    DrawText() uses the font currently selected into the Device Context (DC). Therefore, to change the size of the font, you should first create a new font and select it into the DC (whilst saving the original font handle) in which you are drawing your text, proceed to draw the text in the DC, and finally you should restore the original font and delete the font you created. Of course, this should all take place in the %WM_PAINT handler too, before calling EndPaint() or ReleaseDC() (as appropriate to the manner that your %WM_PAINT handler uses).

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]