MFC窗口拆分后分割条移动的问题
拆分窗口后,想禁止分割条的移动,于是创建一个新类继承于CSplitterWnd,之后在其中的MouseMove,LButtonDown,OnSetCursor,OnLBu...
拆分窗口后,想禁止分割条的移动,于是创建一个新类继承于CSplitterWnd,之后在其中的MouseMove,LButtonDown,OnSetCursor,OnLButtonUp函数都进行了重载,将CSplitterWnd改为了Cwnd,之后达到的效果是编译后,分割条仍可以移动一次,松开鼠标在移动就不好使了,这是怎么回事啊,求大神,急!!!!
展开
1个回答
展开全部
这是解决代码,直接在WM_MOUSEMOVE及WM_LBUTTONDOWN这连个消息处理就好了。如果是禁止滚动,就重设鼠标光标为箭头。
void CFlatSplitterWnd::OnMouseMove(UINT nFlags, CPoint point)
{
// Enable the dragging.
if (m_bEnableDrag)
{
CSplitterWnd::OnMouseMove(nFlags, point);
}
// Disable the dragging.
else
{
HCURSOR hc = LoadCursor(NULL, IDC_ARROW);
SetCursor(hc);
}
}
void CFlatSplitterWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
// Enable the dragging.
if (m_bEnableDrag)
{
CSplitterWnd::OnLButtonDown(nFlags, point);
}
// Disable the dragging.
else
{
HCURSOR hc = LoadCursor(NULL, IDC_ARROW);
SetCursor(hc);
}
}
void CFlatSplitterWnd::OnMouseMove(UINT nFlags, CPoint point)
{
// Enable the dragging.
if (m_bEnableDrag)
{
CSplitterWnd::OnMouseMove(nFlags, point);
}
// Disable the dragging.
else
{
HCURSOR hc = LoadCursor(NULL, IDC_ARROW);
SetCursor(hc);
}
}
void CFlatSplitterWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
// Enable the dragging.
if (m_bEnableDrag)
{
CSplitterWnd::OnLButtonDown(nFlags, point);
}
// Disable the dragging.
else
{
HCURSOR hc = LoadCursor(NULL, IDC_ARROW);
SetCursor(hc);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询