logo       

Re: ListView BackColor: msg#00032

windows.ce.devel

Subject: Re: ListView BackColor

Steve,

Your lparam is cast to a NMLVCUSTOMDRAW pointer.

NMLVCUSTOMDRAW *pcdi = (NMLVCUSTOMDRAW *)lParam;

pcdi->nmcd.dwItemSpec is your row
pcdi->iSubItem is your column

Keep in mind that you need to response to the various draw stages
before you will get this message for each cell.

When dwDrawStage is CDDS_PREPAINT, you have to return CDRF_NOTIFYITEMDRAW.

When dwDrawState is CDDS_ITEMPREPAINT you have to return
CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYSUBITEMDRAW.

When dwDrawState is CDDS_SUBITEM|CDDS_ITEMPREPAINT, then you can paint
your cell. Your return here is also important, or the listview may
paint over what you have done. You can return CDRF_SKIPDEFAULT if you
painted it or CDRF_DODEFAULT if you still want the listview to paint it.

There are also post paint notifications that you can use to add
something to how the listview paints by default.

I vaguely remember having trouble with this when the listview was the
child of a dialog, but I'm not really sure. For listviews that are
children of windows I've created with CreateWindow, it has always
worked well. I've used this method in ce.net 4.0, 4.1, 4.2 and I
believe also in earlier revs of the pocket pc (ie 2002).

Dennis

--- In windowsce-dev@xxxxxxxxxxxxxxx, "sjspain" <sjspain@...> wrote:
>
> Ok, I have looked at the documentation. Without working with it
> just yet, this question seems obvious: when I handle this message,
> how do I know what is sending it? I can get the handle of the
> entire ListView control, but how do I ID the individual elements of
> the control, ie each cell?
>
> In other words, if I want the backcolor of a line to be red if the
> DOB value is <1955 and green if >1955, how do I know which cell or
> item I am handling the message for?
>
> Thanks,
>
> Steve
>
> --- In windowsce-dev@xxxxxxxxxxxxxxx, "dthomsen73" <dennis@>
> wrote:
> >
> > Steve,
> >
> > Take a look at the NM_CUSTOMDRAW message for the listview. By
> > responding properly to these messages, you can custom paint any way
> > you like. You can even custom paint each individual cell.
> >
> > Dennis
> >
> > --- In windowsce-dev@xxxxxxxxxxxxxxx, "sjspain" <sjspain@> wrote:
> > >
> > > Hi, group,
> > >
> > > I am converting a desktop app to the ppc (VS2003.Net). In the
> > > desktop, we use a Listview to keep track of the status of list
> items
> > > by changing each line's back color as that item's status
> changes.
> > > However, we are having trouble implementing the same schema in
> the
> > > windows mobile app.
> > >
> > > It seems the ListView backcolor property is for the whole
> control and
> > > not for each individual line. Is this correct or am I missing
> > > something? Is there a workaround or available opencode
> inherited
> > > control that I can use that will give me the flexibility I need?
> > >
> > > Thanks,
> > >
> > > Steve
> > >
> >
>







------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise