Re: OwnerDraw ListView subitem problems



On 05/10/2008 in message <eecpQpnJJHA.1556@xxxxxxxxxxxxxxxxxxxx> James wrote:

private void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
{
if (e.ColumnIndex == 1)
{
e.DrawBackground();
e.Graphics.DrawImage(e.Item.ImageList.Images[e.Item.ImageIndex], e.SubItem.Bounds.Location);
e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, new SolidBrush(e.SubItem.ForeColor), e.SubItem.Bounds.Location.X + this.imageListTask.Images[0].Width, e.SubItem.Bounds.Location.Y);
}
}

I'm pretty sure I have sen this in another group.
Anyway, you always draw the sub-item in the same style from your code. If you want it to look different for different states you need to check its state and draw it accordingly.

--
Jeff Gaines Damerham Hampshire UK
It may be that your sole purpose in life is to serve as a warning to others.
.



Relevant Pages

  • Re: Kresss Probability Trilogy Qs
    ... James A. Donald wrote: ... must be consistent. ... Even if we draw the right conclusions, ...
    (rec.arts.sf.science)
  • Re: Machine keeps switching off
    ... James wrote: ... sort of problem. ... in a draw somewhere that I have never used. ... The training course I ...
    (uk.comp.homebuilt)
  • Re: MFI bite MDF dust
    ... Interesting construction there, James; should we draw any conclusions ... from the fact that Steve Terry has known /you/ for twenty years rather ...
    (uk.misc)
  • Re: Outlook Toolbar in Access
    ... No, James, ... I AM NOT GOING TO DRAW YOU A PICTURE! ... I got my glasses broken last time I was there so it would be all blurry ...
    (comp.databases.ms-access)
  • Re: PCGS grading process video
    ... I've seen this posted here before, but this time there are other YouTube ... at least on the page I happened to draw. ... his whole U.S. coin collection in slide-show format, ... James ...
    (rec.collecting.coins)