I'm creating several EDIT
elements with a for
loop. When I move the window outside the screen and then back inside, the EDIT
controls disappear, along with a line in the WM_PAINT
event.
The "create" event:
case WM_CREATE:
for( int i =0; i < 4; i++ ){
text = CreateWindow("EDIT","text",WS_VISIBLE | WS_CHILD , 0,i*40+100,100,10, hwnd , NULL, NULL, NULL);
}
// Other elements
break;
The "paint" event:
case WM_PAINT:
{
hdc = GetDC(hwnd);
SetRect(&secondbackground, 0, 70, 800, 500);
FillRect(hdc, &secondbackground, CreateSolidBrush(RGB(0,200,200)) );
ReleaseDC(hwnd, hdc);
hdc = GetDC(hwnd);
SetRect(&secondbackground, 0, 0, 800, 20);
FillRect(hdc, &secondbackground, CreateSolidBrush(RGB(0,100,200)) );
ReleaseDC(hwnd, hdc);
hdc = BeginPaint( hwnd, &ps );
MoveToEx(hdc,1,52,NULL);
LineTo(hdc,100,200);
EndPaint( hwnd, &ps );
hdc = GetDC(hwnd);
SetPixel(hdc,300,300,RGB(255,255,255));
EndPaint( hwnd, &ps );
}
break;
处理WM_PAINT时使用BeginPaint / EndPaint,这将强制执行背景绘制,而GetDC则不执行。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.