📄 splitterwndex.cpp
字号:
// SplitterWndEx.cpp: implementation of the CSplitterWndEx class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TestForm.h"
#include "SplitterWndEx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSplitterWndEx::CSplitterWndEx()
{
m_nHidedCol=-1;
m_nHidedRow=-1;
}
CSplitterWndEx::~CSplitterWndEx()
{
}
void CSplitterWndEx::HideRowColumn(int rowHide,int colHide)
{
}
void CSplitterWndEx::ShowRowColumn(int rowHide,int colHide)
{
}
void CSplitterWndEx::HideColumn(int colHide)
{
ASSERT_VALID(this);
ASSERT(m_nCols>1);
ASSERT(colHide<m_nCols);
int rowActive,colActive;
if (GetActivePane(&rowActive,&colActive)!=NULL&&colActive==colHide)
{
if (++colActive>=m_nCols) colActive=0;
SetActivePane(rowActive,colActive);
}
for (int row=0;row<m_nRows;row++)
{
CWnd* pPaneHide=GetPane(0,colHide);
ASSERT(pPaneHide!=NULL);
pPaneHide->ShowWindow(SW_HIDE);
pPaneHide->SetDlgCtrlID(AFX_IDW_PANE_FIRST+row*16+m_nCols);
for (int col=colHide+1;col<m_nCols;col++)
{
CWnd* pPane=GetPane(row,col);
ASSERT(pPane!=NULL);
pPane->SetDlgCtrlID(IdFromRowCol(row,col-1));
}
}
m_nCols--;
m_pColInfo[m_nCols].nCurSize=m_pColInfo[colHide].nCurSize;
RecalcLayout();
m_nHidedCol=colHide;
}
void CSplitterWndEx::ShowColumn()
{
if (m_nHidedCol<0) return;
ASSERT_VALID(this);
ASSERT(m_nCols<m_nMaxCols);
int colNew=m_nHidedCol;
m_nHidedCol=-1;
int cxNew=m_pColInfo[m_nCols].nCurSize;
m_nCols++;
for (int row=0;row<m_nRows;row++)
{
CWnd* pPaneShow=GetDlgItem(AFX_IDW_PANE_FIRST+row*16+m_nCols);
ASSERT(pPaneShow!=NULL);
pPaneShow->ShowWindow(SW_SHOWNA);
for (int col=m_nCols-2;col>=colNew;col--)
{
CWnd* pPane=GetPane(row,col);
ASSERT(pPane!=NULL);
pPane->SetDlgCtrlID(IdFromRowCol(row,col+1));
}
pPaneShow->SetDlgCtrlID(IdFromRowCol(row,colNew));
}
m_pColInfo[colNew].nCurSize=cxNew;
RecalcLayout();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -