Exemplo n.º 1
0
void CCheckListBoxEx::PreSubclassWindow()
{
	CCheckListBox::PreSubclassWindow();

	const int nStates[] = { CBS_UNCHECKEDNORMAL, CBS_CHECKEDNORMAL };//, CBS_MIXEDNORMAL };
	const int nNumStates = sizeof(nStates) / sizeof(int);
	
	CThemed th;
	
	if (th.Open(this, _T("BUTTON")) && th.AreControlsThemed())
	{
		th.BuildImageList(m_ilCheck, BP_CHECKBOX, nStates, nNumStates);

		IMAGEINFO ii;
		m_ilCheck.GetImageInfo(0, &ii);
		m_nImageHeight = (ii.rcImage.bottom - ii.rcImage.top);
	}
}
Exemplo n.º 2
0
BOOL CEnHeaderCtrl::DrawItemSortArrow(CDC* pDC, int nItem, BOOL bUp) const
{
	ASSERT (nItem >= 0 && nItem < GetItemCount());

	CRect rArrow;
	
	if (!GetItemRect(nItem, rArrow))
		return FALSE;

	static CThemed th(this, _T("Header"));
	
	if (th.AreControlsThemed())
	{
		rArrow.left = rArrow.CenterPoint().x - 6;
		rArrow.right = rArrow.left + 12;
		rArrow.bottom = rArrow.top + 8;
		
		return th.DrawBackground(pDC, HP_HEADERSORTARROW, (bUp ? HSAS_SORTEDUP : HSAS_SORTEDDOWN), rArrow);
	}
	
	// else
	int nOffY = (bUp ? 5 : 3), nOffX = (rArrow.CenterPoint().x - 4);
	int nDir = (bUp ? -1 : 1);
	
	POINT ptArrow[3] = { { 0, 0 }, { 3, (int)nDir * 3 }, { 7, -(int)nDir } };
	
	// translate the arrow to the appropriate location
	int nPoint = 3;
	
	while (nPoint--)
	{
		ptArrow[nPoint].x += nOffX;
		ptArrow[nPoint].y += nOffY;
	}
	pDC->Polyline(ptArrow, 3);

	return TRUE;
}