![]() |
Win32 painting
I have the following code, which works fine for printing out my coordinates, the only problem is that if I don't overwrite the old text (say the old text is "200, 200" and the new text is "20, 20" which is 2 characters less) the old text will still be visible (it would still display the "00" from the "200, 200"). How can I fix that? By the way, I already have a WM_PAINT with some other drawing in it.
I thought I could just use InvalidateRect(), but that doesn't work. I hope I'm making sense. :
case WM_LBUTTONDOWN: |
I think you can use the InvalidateRect() function to do this. Post the whole code and I'll try to experiment with that.
|
This is not actually a C++ problem. It is a problem with usage of the win32 library.
Try saving the last text that has been output, and output it again with it's colour set to that of the background. Then output your new text. :
// untested, but illustrates the idea ..... |
Thank you Robert, that worked, I would have thought there to be a more direct way of doing it. I could of course draw a rectangle with the color of the background, but I like this (your) way better. :)
@InfoGeek: I'll show you what I have anyway. I know, I might have mixed C and C++ here a lot, my framework application was C, but I decided doing it in C++ was nicer. :
/* Includes */ |
I was thinking of calling just InvalidateRect() when you receive WM_LBUTTONDOWN message and outputting the coordinates in WM_PAINT along with the other code. But grumpy's solution is better.
|
Quote:
Sorry...just in a silly mood. :p |
So you're making a house? :D
|
Quote:
I wanted to push a floor and make an elevator come, so that it will be act like a real elevator. I always hate waiting so long for elevators, so I thought I might be able to prove that I'm waiting too long by making this application. :p Oh, I just looked on google and saw a couple of school assignments for the same, but they use pthread (*nix). A working solution. And well the house is a building I can see accross from where I work (where I am at right now), in reality the building here is yellow, but I like the color blue better. ;) |
| All times are GMT -5. The time now is 5:09 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC