CGXBitmapButtonChild::CGXBitmapButtonChild

CGXBitmapButtonChild(CGXControl* pComposite);

pComposite

Pointer to the parent control object.

Remarks

Constructs a button child object.

You should create and add the button child in the constructor of your CGXControl-derived class (see example).

The rectangle for the button should be passed to the child object when the control’s OnInitChildren method is called.

Example

This example shows how you can add a child to your control:

CBtnEdit::CBtnEdit(CGXGridCore* pGrid, UINT nID)
   : CGXEditControl(pGrid, nID)
{
   AddChild(m_pButton = new CGXBitmapButtonChild(this));
   VERIFY(m_pButton->LoadBitmaps(IDB_BITMAP1));
   m_sizeBtn = CSize(14,14);
}
void CBitmapBtnEdit::OnInitChildren(ROWCOL nRow, ROWCOL nCol, const CRect& rect)
{
   nRow, nCol;
   int nTop = (max(0, rect.Height() - m_sizeBtn.cy)) / 2;
   // init BitmapBtn button
   CRect rectBtn;
   rectBtn.IntersectRect(rect,
            CRect(rect.left+3,
               rect.top + nTop,
               rect.left+3+m_sizeBtn.cx,
               rect.top+ nTop + m_sizeBtn.cy)
            );
   m_pButton->SetRect(rectBtn);
}

See Also

 CGXControl::CGXControl  CGXControl::OnInitChildren  CGXChild::SetRect

CGXBitmapButtonChild

 Class Overview |  Class Members