all groups > dotnet windows forms > july 2006 >
You're in the

dotnet windows forms

group:

ListView (CLR 2.0) in virtual mode and OwnerDraw = true


ListView (CLR 2.0) in virtual mode and OwnerDraw = true Frédéric de Buisseret
7/31/2006 11:01:02 AM
dotnet windows forms:
Hi,

I use the new version of the ListView (.net framework 2.0). I decided to
make it virtual (due to the large amount of items) and set the ownerdraw
property to true (to have the full control of the items drawing).

The items (and sub items) are correctly displayed as long as i do not move
the mouse over the subitems. Since i start to move the mouse over the
subitems, the content (a string) disapears. It is like the Invalidate was not
correctly done internally by the control. I put a break point in the function
that draws the subitems and i never get into it (protected override void
OnDrawSubItem).


Here are the functions used to accomplish the work:

protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs
e)
protected override void OnDrawItem(DrawListViewItemEventArgs e)
protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
protected override void OnRetrieveVirtualItem(RetrieveVirtualItemEventArgs e)

In my constructor i set the following properties;

SetStyle(ControlStyles.DoubleBuffer, true);
this.OwnerDraw = true;
this.VirtualMode = true;
this.DoubleBuffered = true;

I suspect a bug in the CLR. I would really appreciate if someone could light
my candle on that issue.

Thank you!

Regards,
Re: ListView (CLR 2.0) in virtual mode and OwnerDraw = true Dave Sexton
8/1/2006 11:59:05 PM
Hi Fred,

Are you filtering which items are drawn in the OnDrawItem and OnDrawSubItem overrides by the ListViewItemStates value supplied by
their respective event arguments?

It might be that you have HotTracking enabled and your not drawing the Hot state.

--
Dave Sexton

[quoted text, click to view]

AddThis Social Bookmark Button