如何让CMFCTabCtrl关闭按钮关闭属性页
答案:2 悬赏:0 手机版
解决时间 2021-04-14 12:04
- 提问者网友:爱唱彩虹
- 2021-04-13 12:52
如何让CMFCTabCtrl关闭按钮关闭属性页
最佳答案
- 五星知识达人网友:七十二街
- 2021-04-13 13:50
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 ;
}
}
全部回答
- 1楼网友:廢物販賣機
- 2021-04-13 14:14
同问。。。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯