No announcement yet.

ListView background

  • Filter
  • Time
  • Show
Clear All
new posts

  • Jules Marchildon

    Cut and Pasted notes I had from searching awhile back on the subject.
    I havn't tried it yet.

    The ListView control's appearance is particularly difficult to
    customize due to the fact that the LVS_OWNERDRAWFIXED style is
    only applicable to report-mode ListViews.

    Further, handling the WM_DRAWITEM message is a major hassle since
    every aspect of each item needs to be drawn manually.

    What happens when you need to change only the color of a
    particular item in another ViewStyle? Without Custom Draw,
    you'd need to subclass the ListView and handle the WM_PAINT
    message directly -- not a pretty task. In fact, handling
    the WM_PAINT message requires almost a complete rewrite of
    the entire control's drawing mechanism. This is obviously
    not a good solution for changing only a small aspect of the
    ListView's appearance. Luckily with the release of comctl32
    version 4.70 (IE3) Microsoft introduced the Custom Draw

    For a brief primer on Custom Draw, search the MSDN "Custom Draw".

    To use the Custom Draw service, you need to handle the WM_NOTIFY
    message and test the code member of the NMHDR member of the
    NMCUSTOMDRAW structure (sent as the LParam) for the
    NM_CUSTOMDRAW notification. Also, test the hwndFrom member of
    the NMHDR to make sure the notification corresponds to the
    target control. From there, simply test the drawing stage and
    respond with the correct CDRF_* constant(response flag).
    <<end quote>>

    Regards, Jules

    [This message has been edited by Jules Marchildon (edited June 06, 2000).]

    Leave a comment:

  • Scott Turchin
    started a topic ListView background

    ListView background

    Is it possible to paint the back of a listview with say a notepad type BMP file? (Embedded in .RC file).???

    I have an idea, combined with a cursor that would really enhance my program's visual piece...


    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet