Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

Called to paint the item's icon when it has one or more child items. The default implementation paints a rectangle with a plus sign if the item is expanded and a rectangle with a minus sign if it is collapsed.

void OnTreeGridPaintExpandButton(
   CDC & dc,
   HTREEITEM hTreeItem,
   bool bExpanded,
   const CRect & rcIndent
) const;

Parameters

dc
Device context for painting.
hTreeItem
Handle of the tree item.
bExpanded
Indicates that the child items of the parent specified by hTreeItem are expanded if bExpanded is true; collapsed otherwise.
rcIndent
Specifies the indent rectangle of the item.

Remarks

void CMyTreeGridWnd::OnTreeGridPaintExpandButton(
CDC & dc,
HTREEITEM hTreeItem,
bool bExpanded,
const CRect & rcIndent
) const
{
CWinApp * pApp = ::AfxGetApp();
HICON hIcon;
if ( bExpanded == true)
{
hIcon = pApp->LoadIcon (IDI_ICON_OPEN_BOOK);
}
else
{
hIcon = pApp->LoadIcon (IDI_ICON_CLOSED_BOOK);
}

ASSERT ( hIcon != NULL );
CRect rcDst( rcIndent.left, rcIndent.top, rcIndent.left + 16, rcIndent.top + 16 );
rcDst.OffsetRect(
( rcIndent.Width() - rcDst.Width() ) / 2,
( rcIndent.Height() - rcDst.Height() ) / 2
);
CExtBitmap _bmp;
_bmp.AssignFromHICON( hIcon );
_bmp.AlphaBlend( dc.m_hDC, rcDst );

}

See Also

CExtTreeGridWnd Overview | Class Members | Hierarchy Chart