none
[Subclassing ListView] How to receive WM_DRAWITEM event ?

    Domanda

  • Hello everybody,

    I have a .Net (C#) project for Windows CE 5 .

    It's a GUI for which I overload all controls (or nearly) to do what I want and to accelerate the creation of screens in the future...

    In one of the screens, I have a ListView, "CustomListView " that derives from the Windows ListView.
    Here, I would like to display some information in a column such as a progress bar, a flag, etc.
    So I would like to draw the lines myself!

    As we are in the .Net CF, we can't override the OnPaint method, can we?

    What I managed to do is to intercept WM_PAINT Windows message and in my handler, I can draw what I want in the ListView control.
    The problem is that it makes me redraw every time the column headers, manage the selected line (I do but the behavior is strange), the scroll, etc...

    What I would do is to subscribe to the event which is sent each time a line is drawing!
    I understood that it's WM_DRAWITEM , isn't it?
    But by default (it's what I understood once again), we don't receive it because it isn't sent.
    We must put the property LVS_OWNERDRAWFIXED !
    I also add LVS_REPORT ...

    Ok, the event seems to be sent (I see header but no line) but I don't receive the WM_DRAWITEM to call my handler and display my rows

    Usefull links:
    http://msdn.microsoft.com/en-us/library/ms229681.aspx
    http://msdn.microsoft.com/en-us/library/aa453379.aspx

    I did someting wrong?

    Thank you very much!!
    martedì 28 luglio 2009 08:57

Risposte

Tutte le risposte