steve
2011-02-23 00:04:33 UTC
Hey Guys,
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:
[code]
case WM_PAINT:
hdc = GetDC(hwnd);
BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
DrawText(hdc, "Hello World!.", -1, &rect, DT_SINGLELINE |
DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &ps);
ReleaseDC(hwnd, hdc);
break;
[/code]
then, else where, (in another function) I issue a gdi line-draw
command like so:
[code]
void DrawLine(HWND hwnd)
{
int x1=50, y1=50, x2=50, y2=150;
HDC myhDC;
myhDC = GetDC(hwnd);
MoveToEx(myhDC, x1, y1, NULL);
LineTo(myhDC, x2, y2);
ReleaseDC(hwnd, myhDC);
}
[/code]
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.
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 ?
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:
[code]
case WM_PAINT:
hdc = GetDC(hwnd);
BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
DrawText(hdc, "Hello World!.", -1, &rect, DT_SINGLELINE |
DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &ps);
ReleaseDC(hwnd, hdc);
break;
[/code]
then, else where, (in another function) I issue a gdi line-draw
command like so:
[code]
void DrawLine(HWND hwnd)
{
int x1=50, y1=50, x2=50, y2=150;
HDC myhDC;
myhDC = GetDC(hwnd);
MoveToEx(myhDC, x1, y1, NULL);
LineTo(myhDC, x2, y2);
ReleaseDC(hwnd, myhDC);
}
[/code]
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.
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 ?