Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog as a control Pin
Maximilien28-Feb-03 2:31
Maximilien28-Feb-03 2:31 
GeneralRe: Dialog as a control Pin
benjymous28-Feb-03 2:48
benjymous28-Feb-03 2:48 
GeneralRe: Dialog as a control Pin
Maximilien28-Feb-03 3:18
Maximilien28-Feb-03 3:18 
GeneralRe: Dialog as a control Pin
Gary R. Wheeler1-Mar-03 2:13
Gary R. Wheeler1-Mar-03 2:13 
GeneralForce wnd update Pin
Zizilamoroso28-Feb-03 1:35
Zizilamoroso28-Feb-03 1:35 
GeneralRe: Force wnd update Pin
Hans Ruck28-Feb-03 1:39
Hans Ruck28-Feb-03 1:39 
GeneralListCtrl Custom Draw Pin
ROK_RShadow28-Feb-03 1:20
ROK_RShadow28-Feb-03 1:20 
GeneralRe: ListCtrl Custom Draw Pin
Roger Allen28-Feb-03 1:37
Roger Allen28-Feb-03 1:37 
I have been working from the same article just yesterday. Hers a copy of mu OnCustom draw...

void CCommunicationView::OnCustomDrawLog(NMHDR* pNMHDR, LRESULT* pResult)
{
	NMLVCUSTOMDRAW *pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
	
	*pResult = CDRF_DODEFAULT;			// assume normal windows drawn control
	
	if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
	{
		*pResult = CDRF_NOTIFYITEMDRAW;
	}
	else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
	{
		// this is the prepaint stage, we need each sub-item pre-paint
		*pResult = CDRF_NOTIFYSUBITEMDRAW;
	}
	else if ((CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
	{
		// now render the image if it has one
		int		item = pLVCD->nmcd.dwItemSpec;
		LVITEM rItem;
        ZeroMemory(&rItem, sizeof(LVITEM));
        rItem.mask = LVIF_IMAGE | LVIF_STATE;
        rItem.iItem = item;
        rItem.stateMask = LVIS_SELECTED;
        m_Log.GetItem(&rItem );
		// we render the text ourselves in the right colour and take tabs into account
		int		value = m_Log.GetItemData(item);
		CDC*	pDC = CDC::FromHandle ( pLVCD->nmcd.hdc );
		CRect	rcText;
		CRect	rcIcon;
		CString	text;
		
		m_Log.GetItemRect(item, &rcIcon, LVIR_ICON);
		m_Log.GetItemRect(item, &rcText, LVIR_BOUNDS);
		rcText.left += rcIcon.Width();

		text = m_Log.GetItemText(item, 0);
		if (rItem.state & LVIS_SELECTED)
		{
			pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
			CBrush	brush(GetSysColor(COLOR_HIGHLIGHT));
			pDC->FillRect(rcText, &brush);
		}
		else
		{
			pDC->SetTextColor(value);
			CBrush	brush(GetSysColor(COLOR_HIGHLIGHTTEXT));
			pDC->FillRect(rcText, &brush);
		}
		pDC->DrawText(text, rcText, DT_END_ELLIPSIS | DT_EXPANDTABS | DT_SINGLELINE | DT_VCENTER);
		pLVCD->clrText = value;
		m_ilLog.Draw(pDC, rItem.iImage, rcIcon.TopLeft(), ILD_TRANSPARENT);
		*pResult = CDRF_SKIPDEFAULT;
	}
}



Roger Allen
Sonork 100.10016

Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
GeneralRe: ListCtrl Custom Draw Pin
ROK_RShadow28-Feb-03 2:02
ROK_RShadow28-Feb-03 2:02 
GeneralCreating owner draw component in MFC Pin
Dennis Kuppens28-Feb-03 1:02
Dennis Kuppens28-Feb-03 1:02 
GeneralRe: Creating owner draw component in MFC Pin
Joan M28-Feb-03 1:11
professionalJoan M28-Feb-03 1:11 
GeneralRe: Creating owner draw component in MFC Pin
Dennis Kuppens9-Mar-03 20:13
Dennis Kuppens9-Mar-03 20:13 
GeneralRe: Creating owner draw component in MFC Pin
Big Art1-Mar-03 5:12
Big Art1-Mar-03 5:12 
GeneralHHEEELLLPPPP: global integer! Pin
Sunnygirl28-Feb-03 0:20
Sunnygirl28-Feb-03 0:20 
GeneralRe: HHEEELLLPPPP: global integer! Pin
João Paulo Figueira28-Feb-03 0:40
professionalJoão Paulo Figueira28-Feb-03 0:40 
GeneralRe: HHEEELLLPPPP: global integer! Pin
Sunnygirl28-Feb-03 1:22
Sunnygirl28-Feb-03 1:22 
GeneralRe: HHEEELLLPPPP: global integer! Pin
João Paulo Figueira28-Feb-03 1:29
professionalJoão Paulo Figueira28-Feb-03 1:29 
GeneralRe: HHEEELLLPPPP: global integer! Pin
Sunnygirl28-Feb-03 1:45
Sunnygirl28-Feb-03 1:45 
GeneralRe: HHEEELLLPPPP: global integer! Pin
berndg28-Feb-03 0:45
berndg28-Feb-03 0:45 
GeneralRe: HHEEELLLPPPP: global integer! Pin
Sunnygirl28-Feb-03 1:21
Sunnygirl28-Feb-03 1:21 
GeneralRe: HHEEELLLPPPP: global integer! Pin
berndg28-Feb-03 1:41
berndg28-Feb-03 1:41 
GeneralRe: HHEEELLLPPPP: global integer! Pin
Joan M28-Feb-03 0:48
professionalJoan M28-Feb-03 0:48 
GeneralOpenOffice - API (MailMerging) Pin
MrEyes28-Feb-03 0:02
MrEyes28-Feb-03 0:02 
GeneralRe: OpenOffice - API (MailMerging) Pin
Daniel Turini28-Feb-03 1:45
Daniel Turini28-Feb-03 1:45 
GeneralRe: OpenOffice - API (MailMerging) Pin
MrEyes28-Feb-03 6:22
MrEyes28-Feb-03 6:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.