Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtPropertyGridCtrl border Collapse All
Subject Author Date
Offer Har Jun 24, 2007 - 6:21 AM

Dear Support,

I see that the CExtPropertyGridCtrl have a 1 pixel wide frame around it.
Is there a way to remove it?

Thanks,
Ron.

Offer Har Jun 25, 2007 - 6:18 AM

Thanks!
As always, to the point and clear.

Technical Support Jun 25, 2007 - 5:16 AM


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.