[Mono-bugs] [Bug 477438] Virtual/ownerdraw Listview cant handle >16 item
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Feb 18 18:19:02 EST 2009
https://bugzilla.novell.com/show_bug.cgi?id=477438
User Dax at daxxfiles.net added comment
https://bugzilla.novell.com/show_bug.cgi?id=477438#c2
--- Comment #2 from - - <Dax at daxxfiles.net> 2009-02-18 16:19:02 MST ---
I use mono svn. And it seems that I didn't mention something :/
This version _does_ die.
using System;
using System.Windows.Forms;
public class Test
{
static void Main ()
{
Application.Run (new TestForm ());
}
}
public class TestForm : Form
{
ListView lv;
ListViewItem [] items_cache;
public TestForm ()
{
lv = new ListView ();
lv.VirtualMode = true;
lv.RetrieveVirtualItem += RetrieveVirtualItemHandler;
lv.Dock = DockStyle.Fill;
lv.Columns.Add ("One");
lv.Columns.Add ("Two");
lv.View = View.Details;
lv.FullRowSelect = true;
lv.OwnerDraw = true;
lv.DrawItem += DrawListViewItemHandler;
lv.DrawColumnHeader += DrawListViewColumnHeaderHandler;
lv.Parent = this;
items_cache = new ListViewItem [lv.VirtualListSize];
lv.VirtualListSize = 17;
lv.Refresh();
}
void DrawListViewColumnHeaderHandler (object o,
DrawListViewColumnHeaderEventArgs args)
{
args.DrawDefault = true;
}
void DrawListViewItemHandler (object o, DrawListViewItemEventArgs args)
{
args.DrawDefault = true;
}
void RetrieveVirtualItemHandler (object o, RetrieveVirtualItemEventArgs
args)
{
if (items_cache [args.ItemIndex] == null) {
ListViewItem item = new ListViewItem ("Item " +
args.ItemIndex);
item.SubItems.Add ("Sub item " + args.ItemIndex +
"-1");
items_cache [args.ItemIndex] = item;
}
args.Item = items_cache [args.ItemIndex];
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list