15,979
社区成员
发帖
与我相关
我的任务
分享
//这是WM_PAINT消息的处理
void CMyComboBox::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rcClient;
GetClientRect(&rcClient);
// Let the window do its default painting...
CWnd::DefWindowProc( WM_PAINT, (WPARAM)dc.GetSafeHdc(), 0 );
// Do not call CComboBox::OnPaint() for painting messages
}
void CMyComboBox::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (FALSE == m_bOver)
{
m_bOver = TRUE;
SetCapture(); //捕获鼠标以监视鼠标是否已经离开编辑框
Invalidate();
}
CRect rcClient;
GetClientRect(&rcClient);
if (rcClient.PtInRect(point) == FALSE)
{
m_bOver = FALSE;
GetParent()->Invalidate();
ReleaseCapture();
}
CComboBox::OnMouseMove(nFlags, point);
}
BOOL CMyComboBox::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return TRUE;
}