4
在进行分割窗口的时候可以从CSplitterWnd派生一个类出来,然后改变其中的成员变量达到改变分隔栏的目的,对以下三个函数进行重载可以使屏蔽对分隔栏的操作
保护的成员变量有如下几个:
1. m_cxSplitter=10;
2. m_cxSplitterGap=10;//垂直分隔条的大小
3. m_cySplitter=10;
4. m_cySplitterGap=10;//水平分隔条
5. m_cxBorderShare=0;
6. m_cyBorderShare=0;//边界设置
7. m_cxBorder=0;
8. m_cyBorder=0;//界面设置
需要重载的消息函数有如下三个:
BEGIN_MESSAGE_MAP(CMySplitterWnd, CSplitterWnd)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_SETCURSOR()
END_MESSAGE_MAP()
//也可以直接注释掉
void CMySplitterWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnLButtonDown(nFlags, point);
}
void CMySplitterWnd::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnMouseMove(nFlags, point);
}
BOOL CMySplitterWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
return CWnd::OnSetCursor(pWnd, nHitTest, message); /
}
5.要减少使用goto语句,它会破坏程序的模块化,容易造成程序流程的混乱,增加程序的可理解性,和调试程序的难度,但是goto语句也是比较高效的。
所以goto语句不推荐使用,但不禁止使用。
6.VC中常常可以看到大写的BOOL INT 等一些类型,他们的用法和bool int 基本一样,只是微软在VC中定义成这样是为了方便升级来用。
比如说:
typedef int INT 那么INT是int型
如果改成 typedef long int INT 那么INT又是另外一种类型了