okay, still learning...,
let's assume I open a single gui window and draw some text on it via WM_PAINT, (which is in my wndproc() function), like below:
then, else where, (in another function) I issue a gdi line-draw command like so:
DrawText(hdc, "Hello World!.", -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
In the center of my window I have text that reads "Hello World!" and near the upper left corner, I have a 100 pixels long line.
void DrawLine(HWND hwnd)
int x1=50, y1=50, x2=50, y2=150;
myhDC = GetDC(hwnd);
MoveToEx(myhDC, x1, y1, NULL);
LineTo(myhDC, x2, y2);
I can drag my window all over the screen and my two objects remain in tact.
However, if I cover my window with another window, only the text remains when I toggle back to my window. The gdi line is no longer displayed.
How would I get windows to redraw the entire contents of the window, including the gdi line I have drawn ?
(without putting the line-draw routine inside of WM_PAINT, that is).