View Full Version : DrawSubItem in SECTreeCtrl does not works in the Stringray Studio 11.0

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)
if (pPC->lvi.iSubItem == 0)

//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.

03-04-2013, 11:18 AM
SECTreeCtrl problems with LvPaintContext are almost always caused by a Platform Targeting mismatch. The fact that you have changed build platform supports this.

When you install Stingray Studio, the installer updates the file ...\Include\SupportedPlatforms.h to target the platform on which Stingray Studio is installed. The Stingray libraries are all built using this header file to control Platform Targeting. Previously, this was controlled by setting WINVER and _WIN32_WINNT either in code or in project settings. If you have these older targeting macros in your application, they are probably not set to the version of Windows on which Stingray Studio is installed.

Please check that you do not have definitions for WINVER or _WIN32_WINNT anywhere in your code or project settings, then be sure to #include SupportedPlatforms.h in your stdafx.h file, preferably as the first included file. This will ensure that your application is built for the same platform as the Stingray libraries.

Note that if you are a current customer, you can submit a support request at http://www.roguewave.com/support/contact-support/file-a-support-request.aspx.

03-06-2013, 01:05 AM
Thank you very much Terry. The problem got resolved by including SupportedPlatforms.h in the stdafx.h.