有一些问题:
1 如何去掉CFormView的滚动条? 2 如何使CFormView和CSplitterWnd相平,即CFormView不是凹下去的视觉
3 如何设置CSplitterWnd两边窗口的最小宽度,即不会被CSplitterWnd拖到为0
4 能否在CSplitterWnd边加上CToolBar
1:选择FormView的对话框 属性去掉水平和竖直滚动条属性,如果还不行加如下代码:
void CXXXX::OnInitialUpdate()
{ CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_nMapMode = -1;
}
2:我想只能重载Splitter类了,然后再OnDrawSplitter里修改如下(已验证);
该代码的功能是让Splitter不画3D效果,也就是外边框和中间填充一个颜色,现在画灰色
void CMySplitter::OnDrawSplitter(CDC *pDC, ESplitType nType, const CRect &rectArg)
{
if (pDC == NULL)
{
RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
return;
}
ASSERT_VALID(pDC);
// otherwise, actually draw
COLORREF clrGray = RGB( 204, 204, 204 );
if(nType == splitBorder)
{
pDC->Draw3dRect(rectArg, clrGray , clrGray );
rect.DeflateRect(1, 1);
pDC->Draw3dRect( rectArg, clrGray , clrGray );
return;
}
pDC->FillSolidRect( rectArg, clrGray );
}
3:比较简单的办法就是重载splitter的OnMouseMove函数,比如你想设定该竖直分割条最左不得小于20象素
void CMySplitter::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if( point.x > 20 )
CSplitterWnd::OnMouseMove(nFlags, point);
else
return;
}
4:Splitter也是窗口,当然可以,不过我不知道这样做有什么意义哦?