PDA

View Full Version : SECTreeCtrl and CDC



feffe
03-25-2010, 05:19 AM
Hi,

I have a SECTreeCtrl in my app. It seems I can't use
a CClientCDC for painting on it...

Is it true?
So, what workaround do you suggest?

Thanks a lot

CodeMonkey
05-06-2010, 08:50 AM
Try something like:

CDC* pDC = new CClientDC( &m_tree );

// do something interesting as shown below
for( int i = 0; i < (int)m_tree.GetCount(); i++ )
{
HTREEITEM hItem = m_tree.GetItemAt( i );
szText = m_tree.GetItemText( hItem, iCol );
pDC->DrawText( szText, rect, DT_CALCRECT ); // use CClientDC here
iMax = max( iMax, rect.Width() ); rect.SetRectEmpty();
}

This assumes CMyClass is your class which contains the SECTreeCtrl, and that m_tree is that tree control.
Without more detail about what you are trying to paint, this may or may not be helpful to you.