Rajeshwar
02-27-2013, 03:38 AM
We have migrated our visual studio project from 2005 to 2010. Our project source in 2005 is as follows and the same is not working in the 2010. We are using Stingray version 11.0 libraries.
LvPaintContext* pPC in the DrawSubItem has some problem with respect to CDC object. I mean CDC object in the LvPaintContext is passed with NULL which is not allowing to customize the tree with color/font.
CUxx_MS_TreeCtrl class is derived from SECTreeCtrl
void CUxx_MS_TreeCtrl::DrawSubItem(LvPaintContext* pPC)
{
COLORREF txtColor = GetRGBColor(UXX_BLACK);
if (pPC->lvi.iSubItem == 0)
{
try{
//Get our owner drawn data
CString strText;
int iImage;
CRect rectText,rcIndent;
BOOL bEditing = (pPC->lvi.iItem == m_nEditItem) && (pPC->iCol == m_nActiveColumn);
TvPaintContext* pTvPC = dynamic_cast<TvPaintContext*>(pPC);
BOOL bSelected = (pTvPC->tvi.state & TVIS_SELECTED) != 0;
iImage = bSelected ? pTvPC->tvi.iSelectedImage : pTvPC->tvi.iImage;
BOOL bHasImage = HasImage(&(pTvPC->tvi));
strText = pPC->lvi.pszText;
// Fill with background color
CRect rectFill;
CBrush brush(pPC->rgbItemBkgnd);
rectFill = pPC->rect;
int xOrigin = pPC->rect.left;
// Compute text size and position
rectText = pPC->pItem->rcText;
rectText.left += xOrigin;
rectText.top += pPC->rect.top;
rectText.right += xOrigin;
rectText.bottom += pPC->rect.top;
// If we have multiple columns, next columns clip the text of previous columns
if ( GetColumnCount() > 1 || pPC->pdc->IsPrinting() )
rectText.right = pPC->rect.right - SEC_RIGHT_OFFSET;
..............
We have observed CDC object under LvPaintContext *pPC is not creating properly.
Can some one help me in resolving the issue.
LvPaintContext* pPC in the DrawSubItem has some problem with respect to CDC object. I mean CDC object in the LvPaintContext is passed with NULL which is not allowing to customize the tree with color/font.
CUxx_MS_TreeCtrl class is derived from SECTreeCtrl
void CUxx_MS_TreeCtrl::DrawSubItem(LvPaintContext* pPC)
{
COLORREF txtColor = GetRGBColor(UXX_BLACK);
if (pPC->lvi.iSubItem == 0)
{
try{
//Get our owner drawn data
CString strText;
int iImage;
CRect rectText,rcIndent;
BOOL bEditing = (pPC->lvi.iItem == m_nEditItem) && (pPC->iCol == m_nActiveColumn);
TvPaintContext* pTvPC = dynamic_cast<TvPaintContext*>(pPC);
BOOL bSelected = (pTvPC->tvi.state & TVIS_SELECTED) != 0;
iImage = bSelected ? pTvPC->tvi.iSelectedImage : pTvPC->tvi.iImage;
BOOL bHasImage = HasImage(&(pTvPC->tvi));
strText = pPC->lvi.pszText;
// Fill with background color
CRect rectFill;
CBrush brush(pPC->rgbItemBkgnd);
rectFill = pPC->rect;
int xOrigin = pPC->rect.left;
// Compute text size and position
rectText = pPC->pItem->rcText;
rectText.left += xOrigin;
rectText.top += pPC->rect.top;
rectText.right += xOrigin;
rectText.bottom += pPC->rect.top;
// If we have multiple columns, next columns clip the text of previous columns
if ( GetColumnCount() > 1 || pPC->pdc->IsPrinting() )
rectText.right = pPC->rect.right - SEC_RIGHT_OFFSET;
..............
We have observed CDC object under LvPaintContext *pPC is not creating properly.
Can some one help me in resolving the issue.