南通中远川崎最新招聘:InvalidateRect(NULL) 在程序段中的作用

来源:百度文库 编辑:中科新闻网 时间:2024/05/06 08:16:39
void CLinkButton::OnTimer(UINT nIDEvent)
{
static bool pPainted = false;
POINT pt;
GetCursorPos(&pt);
CRect rect;
GetWindowRect (rect);
if (bLBtnDown)
{
KillTimer (1);
if (pPainted) InvalidateRect (NULL);
pPainted = FALSE;
return;
}

if (!rect.PtInRect (pt))
{
bHighlight = false;
KillTimer (1);

if (pPainted)
InvalidateRect(NULL);

pPainted = false;
return;
}
else
{
bHighlight = true;
if (!pPainted)
{
pPainted = true;
InvalidateRect(NULL);
}
}

CButton::OnTimer(nIDEvent);
}

InvalidateRect是将指定的矩形区域加入刷新区域,如果矩形区域参数为NULL,则将全部窗口区域加入刷新区域。