The UpdateWindow function updates the client area of the specified window by sending a WM_PAINT message to the window if the window's update region is not empty. The function sends a WM_PAINT message directly to the window procedure of the specified window, bypassing the application queue. If the update region is empty, no message is sent. The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn.
The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn.
收到WM_PAINT消息后绘制客户区,很多时候只需要更新很小的一个区域就可以了。例如
当某小窗口覆盖了部分客户区的时候情况就是如此。关闭小窗口,需要重画的只是先前被小窗口遮住的矩形区域。这个区域:“无效区域”
{
......
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// 分析菜单选择:
switch (wmId)
{
case IDM_ADDRECORD://这是菜单ID
在这里的操作是新建一个结点,添加到一个列表中,然后使窗口刷新。
//我调用的是UpdateWindow(hWnd).结果是没能实现窗口的刷新。
...
}
seu07201213(【卐】〖汪洋中的一片叶子〗≈^︵^≈):
是不是这个时候,我的窗口中没有存在无效区,所以,调用UpdateWindow(hWnd)是没用的?
而只能用InvalidateWindowRect(...)来强行的使整个客户区无效(我要重绘客户区中的所有内容)?