Click here to Skip to main content
15,884,078 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Physical drive size Pin
john563220-Jul-13 1:36
john563220-Jul-13 1:36 
GeneralRe: Physical drive size Pin
Jochen Arndt20-Jul-13 2:02
professionalJochen Arndt20-Jul-13 2:02 
GeneralRe: Physical drive size Pin
john563220-Jul-13 3:53
john563220-Jul-13 3:53 
GeneralRe: Physical drive size Pin
Jochen Arndt20-Jul-13 23:35
professionalJochen Arndt20-Jul-13 23:35 
GeneralRe: Physical drive size Pin
Richard MacCutchan20-Jul-13 2:42
mveRichard MacCutchan20-Jul-13 2:42 
AnswerRe: Physical drive size Pin
Chris Losinger20-Jul-13 11:27
professionalChris Losinger20-Jul-13 11:27 
GeneralRe: Physical drive size Pin
dusty_dex21-Jul-13 3:31
dusty_dex21-Jul-13 3:31 
QuestionWhat does (need to clear the background) mean? Pin
JoneLe8619-Jul-13 8:33
JoneLe8619-Jul-13 8:33 
here is the question I did ask before:

I have a listview REPORT with fullrowselect style everything works fine, but after i used customdraw I faced a problem such pic included, it seems I click on the item col 3 it becomes bold and more bold..

Picture[^]

if i use listview_update the bold text from the col 3 will be gone so why happens? and i just want to click on the raw without having that bold problem? any ideas?

The Code

C++
if (lpNMHdr->code == NM_CUSTOMDRAW)
{
    LPNMLVCUSTOMDRAW lpCD = (LPNMLVCUSTOMDRAW)lpNMHdr;
    if (lpCD->nmcd.dwDrawStage == CDDS_PREPAINT)
    {
        return CDRF_NOTIFYITEMDRAW;
    }

    if (lpCD->nmcd.dwDrawStage == CDDS_ITEMPREPAINT)
    {
        return CDRF_NOTIFYSUBITEMDRAW;
    }

    if (lpCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT|CDDS_SUBITEM))
    {
        if (lpCD->iSubItem == 0) //detect which subitem is being drawn
        {
            LPCTSTR lpcszBuf1 = _T("example");
            LPCTSTR lpcszBuf2 = _T("text");

            RECT iR = { 0 };
            ListView_GetSubItemRect(lpCD->nmcd.hdr.hwndFrom, lpCD->nmcd.dwItemSpec, lpCD->iSubItem, LVIR_BOUNDS, &iR);

            SetBkMode(lpCD->nmcd.hdc, TRANSPARENT);

            SIZE sz = { 0 };
            GetTextExtentPoint32(lpCD->nmcd.hdc, lpcszBuf1, 7, &sz);

            SetTextColor(lpCD->nmcd.hdc, RGB(255, 0, 0));                   
            DrawText(lpCD->nmcd.hdc, lpcszBuf1, -1, &iR, DT_LEFT);

            iR.left += sz.cx;

            SetTextColor(lpCD->nmcd.hdc, RGB(0, 255, 0));                   
            DrawText(lpCD->nmcd.hdc, lpcszBuf2, -1, &iR, DT_LEFT);                  

            return CDRF_SKIPDEFAULT;
        }
    }


So someone answered me:

If you draw it yourself you need to clear the background as well, which you are not doing. Try using OPAQUE instead of TRANSPARENT.

However, I used OPAQUE but it does not help a lot so, I am trying now with clear the background: the message is wm_ERASEBACKGROUND but what I suppose to do? should I add the code there or what?
QuestionRe: What does (need to clear the background) mean? Pin
David Crow19-Jul-13 9:25
David Crow19-Jul-13 9:25 
AnswerRe: What does (need to clear the background) mean? Pin
JoneLe8619-Jul-13 10:28
JoneLe8619-Jul-13 10:28 
GeneralRe: What does (need to clear the background) mean? Pin
David Crow19-Jul-13 10:39
David Crow19-Jul-13 10:39 
GeneralRe: What does (need to clear the background) mean? Pin
JoneLe8619-Jul-13 13:46
JoneLe8619-Jul-13 13:46 
GeneralRe: What does (need to clear the background) mean? Pin
David Crow19-Jul-13 13:51
David Crow19-Jul-13 13:51 
AnswerRe: What does (need to clear the background) mean? Pin
Jochen Arndt19-Jul-13 22:04
professionalJochen Arndt19-Jul-13 22:04 
GeneralRe: What does (need to clear the background) mean? Pin
JoneLe8620-Jul-13 11:14
JoneLe8620-Jul-13 11:14 
GeneralRe: What does (need to clear the background) mean? Pin
Jochen Arndt20-Jul-13 23:26
professionalJochen Arndt20-Jul-13 23:26 
GeneralRe: What does (need to clear the background) mean? Pin
JoneLe8624-Aug-13 9:34
JoneLe8624-Aug-13 9:34 
SuggestionRe: What does (need to clear the background) mean? Pin
Richard MacCutchan19-Jul-13 22:09
mveRichard MacCutchan19-Jul-13 22:09 
Suggestionerror C2039: 'DebugString' : is not a member of '_DEBUG_EVENT' Pin
ForNow19-Jul-13 4:46
ForNow19-Jul-13 4:46 
GeneralRe: error C2039: 'DebugString' : is not a member of '_DEBUG_EVENT' Pin
Richard MacCutchan19-Jul-13 5:00
mveRichard MacCutchan19-Jul-13 5:00 
GeneralRe: error C2039: 'DebugString' : is not a member of '_DEBUG_EVENT' Pin
ForNow19-Jul-13 5:32
ForNow19-Jul-13 5:32 
QuestionHow can I move CProgressCtrl in CListCtrl? Pin
YannGEF18-Jul-13 22:44
YannGEF18-Jul-13 22:44 
Questiontexture2D stretch Pin
boxfile18-Jul-13 22:29
boxfile18-Jul-13 22:29 
AnswerRe: texture2D stretch Pin
boxfile26-Jul-13 16:40
boxfile26-Jul-13 16:40 
Questionhook game for d3d10 or d3d11 Pin
boxfile18-Jul-13 16:36
boxfile18-Jul-13 16:36 

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.