如何让CMFCTabCtrl关闭按钮关闭属性页
1个回答
2015-01-19
展开全部
CMFCTabCtrl::EnableActiveTabCloseButton
用于在CMFCTabCtrl的Tab页显示一个关闭按钮,看看关闭按钮怎么实现:
void CMFCBaseTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
m_bWindowPosChanged = FALSE;
CWnd::OnLButtonDown(nFlags, point);
if (m_rectCloseButton.PtInRect(point))
{
m_bTabCloseButtonPressed = TRUE;
RedrawWindow(m_rectCloseButton);
return ;
}
...
void CMFCBaseTabCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
if (m_bTabCloseButtonPressed)
{
m_bTabCloseButtonPressed = FALSE;
m_bTabCloseButtonHighlighted = FALSE;
RedrawWindow(m_rectCloseButton);
if (m_rectCloseButton.PtInRect(point))
{
CWnd* pWndActive = GetActiveWnd();
if (pWndActive != NULL)
{
pWndActive->SendMessage(WM_CLOSE);
}
return ;
}
}
用于在CMFCTabCtrl的Tab页显示一个关闭按钮,看看关闭按钮怎么实现:
void CMFCBaseTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
m_bWindowPosChanged = FALSE;
CWnd::OnLButtonDown(nFlags, point);
if (m_rectCloseButton.PtInRect(point))
{
m_bTabCloseButtonPressed = TRUE;
RedrawWindow(m_rectCloseButton);
return ;
}
...
void CMFCBaseTabCtrl::OnLButtonUp(UINT nFlags, CPoint point)
{
if (m_bTabCloseButtonPressed)
{
m_bTabCloseButtonPressed = FALSE;
m_bTabCloseButtonHighlighted = FALSE;
RedrawWindow(m_rectCloseButton);
if (m_rectCloseButton.PtInRect(point))
{
CWnd* pWndActive = GetActiveWnd();
if (pWndActive != NULL)
{
pWndActive->SendMessage(WM_CLOSE);
}
return ;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询