Click here to Skip to main content

C / C++ / MFC

 
QuestionPng Image button problem. Pingroupyu-jian20-Nov-12 7:53 
void CPNGButton::OnLButtonDown(UINT nFlags, CPoint point)
{
	SetCapture();
	SetPNG2Button(m_strMouseDownImagePath);
	CStatic::OnLButtonDown(nFlags, point);
}
 
void CPNGButton::OnLButtonUp(UINT nFlags, CPoint point)
{
	SetPNG2Button(m_strMouseMoveImagePath);
	CStatic::OnLButtonUp(nFlags, point);
}
 
void CPNGButton::OnMouseMove(UINT nFlags, CPoint point)
{
	SetCapture();
	CRect rc;
	GetClientRect(rc);
	if (rc.PtInRect(point))
	{
		if (!m_isPointInWnd)
		{
			OnMouseEnter();
			m_isPointInWnd = TRUE;
		}
	}
	else
	{
		SetPNG2Button(m_strMouseAwayImagePath);
		ReleaseCapture();
		m_isPointInWnd = FALSE;
	}
	CStatic::OnMouseMove(nFlags, point);
}
 
void CPNGButton::OnMouseEnter()
{
	SetPNG2Button(m_strMouseMoveImagePath);
}
 
I create a CPNGButton class to display a button. Using three images to display three different status. No mouse, mouse move, L Button down. CPNGButton is a child class of CStatic. Now if this CPNGButton button is a Minize button, when click this button. After restore the MainFrame, how to restore the minimize button status. Just to how to capture the mouse away from this minimize button?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150123.1 | Last Updated 26 Jan 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid