The following template class removes the non-client border area from any window:
template < class _BC >
class CRemoveNcArea : public _BC
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_NCCALCSIZE
|| message == WM_NCPAINT
)
return 0L;
return _BC::WindowProc( message, wParam, lParam );
}
};
But the
CExtPropertyGridCtrl
control does not implement any non-client area based border. We guess you mean the border around the tree grid inside the property grid control. To remove this border you should use the property grid control which is implemented by the
CPropertyGridCtrlForRon
class declared below:
template < class _BC >
class CRemoveNcAreaFromPropertyTreeGrid : public _BC
{
public:
CRemoveNcAreaFromPropertyTreeGrid (
CExtPropertyGridCtrl * pPropertyGridCtrl = NULL
)
: _BC( pPropertyGridCtrl )
{
}
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_NCCALCSIZE
|| message == WM_NCPAINT
)
return 0L;
return _BC::WindowProc( message, wParam, lParam );
}
};
class CPropertyGridCtrlForRon : public CExtPropertyGridCtrl
{
public:
virtual bool OnPgcCreateGrids();
};
bool CExtPropertyGridCtrl::OnPgcCreateGrids()
{
ASSERT_VALID( this );
try
{
CExtPropertyGridWndCategorized * pGridCategorized =
new CRemoveNcAreaFromPropertyTreeGrid < CExtPropertyGridWndCategorized > ( this );
pGridCategorized->m_bAutoDeleteWindow = true;
if( ! pGridCategorized->Create(
this,
__EXT_MFC_ID_PROPERTY_GRID_CATEGORIZED,
true
)
)
{
ASSERT( FALSE );
throw __EXT_MFC_ID_PROPERTY_GRID_CATEGORIZED;
}
CExtPropertyGridWndSorted * pGridSorted =
new CRemoveNcAreaFromPropertyTreeGrid < CExtPropertyGridWndSorted > ( this );
pGridSorted->m_bAutoDeleteWindow = true;
if( ! pGridSorted->Create(
this,
__EXT_MFC_ID_PROPERTY_GRID_SORTED
)
)
{
ASSERT( FALSE );
throw __EXT_MFC_ID_PROPERTY_GRID_SORTED;
}
}
catch( ... )
{
return false;
}
return true;
}
This class implements the
OnPgcCreateGrids()
virtual method which is similar to the original one but uses the
CRemoveNcAreaFromPropertyTreeGrid
template class. The
CRemoveNcAreaFromPropertyTreeGrid
template class is similar to the
CRemoveNcArea
template class but it has a constructor that is needed for the
CExtPropertyGridWndCategorized
and
CExtPropertyGridWndSorted
classes.