![]() |
Markup in CXTPControlComboBox |
Post Reply
|
| Author | |
scottp
Groupie
Joined: 16 October 2006 Status: Offline Points: 59 |
Post Options
Thanks(0)
Quote Reply
Topic: Markup in CXTPControlComboBoxPosted: 15 April 2010 at 8:19am |
|
Hi,
is it possible to use (simple) markup in a CXTPControlComboBox on a toolbar? I just want to add an icon to each item and make some items italic thanks, scott |
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 13 May 2010 at 4:14pm |
|
Hi;
I'm also interrested in using markup in plain CComboBox or CComboBoxEx. How can this be achieved? |
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
scottp
Groupie
Joined: 16 October 2006 Status: Offline Points: 59 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 May 2010 at 4:38am |
|
class
CControlComboBoxCustomDraw: public
CXTPControlComboBox, CXTPMarkupContext {
DECLARE_XTP_CONTROL(CControlComboBoxCustomDraw)
public:
CControlComboBoxCustomDraw(CXTPCommandBars*
pCommandBars = NULL)
{
GetCommandBar()->SetCommandBars(pCommandBars);
// Require to find Site.
ModifyListBoxStyle(0,
LBS_OWNERDRAWFIXED | LBS_HASSTRINGS);
}
void
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); };
//////////////////////////////////////////////////////////////////////////
// CControlComboBoxCustomDraw
IMPLEMENT_XTP_CONTROL(CControlComboBoxCustomDraw,
CXTPControlComboBox)
void CControlComboBoxCustomDraw::DrawItem(
LPDRAWITEMSTRUCT lpDrawItemStruct ) {
CString
strText;
GetLBText(lpDrawItemStruct->itemID,
strText);
CRect
rc(&lpDrawItemStruct->rcItem);
ASSERT(lpDrawItemStruct->CtlType
== ODT_LISTBOX);
CDC* pDC =
CDC::FromHandle(lpDrawItemStruct->hDC);
BOOL bSelected
= lpDrawItemStruct->itemState & ODS_SELECTED;
CXTPPaintManager*
pPaintManager = GetPaintManager();
COLORREF
crOldTextColor =
pDC->SetTextColor(pPaintManager->GetRectangleTextColor(bSelected,
FALSE, TRUE, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup));
if (bSelected)
pPaintManager->DrawRectangle(pDC,
rc, TRUE, FALSE, TRUE, FALSE, FALSE, xtpBarTypePopup, xtpBarPopup);
else
pDC->FillSolidRect(rc,
pPaintManager->GetXtremeColor(COLOR_WINDOW));
CString
strMarkup = _T("<TextBlock>") + strText +
_T("</TextBlock>");
CXTPMarkupUIElement*
pElement = XTPMarkupParseText(this, strMarkup);
if (pElement)
{
rc.left
+= 3;
XTPMarkupSetDefaultFont(this, 0, pDC->GetTextColor());
XTPMarkupRenderElement(pElement,
pDC->GetSafeHdc(), rc);
XTPMarkupReleaseElement(pElement);
}
}
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |