virtualmode

implementing virtual mode for a datagridview that is databound

牧云@^-^@ 提交于 2019-12-01 07:19:45
问题 A general question for advice on the implementation. I've got a collection bound to a datagridview . BindingList<Line> allLines = new BindingList<Line>(); dataGridView1.DataSource = allLines; I want to implement virtual mode because the collection could contain millions of entries ( Line objects) so I thought it may be quicker to only 'cache' or display a few entries that are needed at a time. Which is what I understand virtual mode to be for? I've looked at: http://msdn.microsoft.com/en-us

Cannot access the selected items collection when the ListView is in virtual mode?

元气小坏坏 提交于 2019-11-30 23:52:52
I have a ListView in Virtual Mode. I wanna to access SelectedItems property. But when I use ListView1.SelectedItems , I receive the following Exception : Cannot access the selected items collection when the ListView is in virtual mode How can I access to ListView1.SelectedItems in VirtualMode. It is quite old post but maybe someone else will benefit. Simply use ListView.SelectedIndexCollection col = listView.SelectedIndices; Then you can access an item: forearch(var item in col) { string txt = listView.Items[item].Text; } ..but you won't be able to iterate through ListView.Items using foreach

How to find out which DataGridView rows are currently onscreen?

时光怂恿深爱的人放手 提交于 2019-11-30 08:45:26
In my C# (2010) application I have a DataGridView in Virtual Mode which holds several thousand rows. Is it possible to find out which cells are onscreen at the moment? Alireza Maddah public void GetVisibleCells(DataGridView dgv) { var visibleRowsCount = dgv.DisplayedRowCount(true); var firstDisplayedRowIndex = dgv.FirstDisplayedCell.RowIndex; var lastvisibleRowIndex = (firstDisplayedRowIndex + visibleRowsCount) - 1; for (int rowIndex = firstDisplayedRowIndex; rowIndex <= lastvisibleRowIndex; rowIndex++) { var cells = dgv.Rows[rowIndex].Cells; foreach (DataGridViewCell cell in cells) { if (cell

How to show icon on all listview items in virtual mode (C#)

╄→гoц情女王★ 提交于 2019-11-29 14:30:01
I'm using virtual mode of listview to show a larg data. But I don't know how to show image for each item. Who can help me ? I wrote private void ListContact_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { MyContact contact = ContactData.GetMyContact(e.ItemIndex); if (e.Item == null) e.Item = new ListViewItem(contact.ToString()); if (contact.Photo != null) { e.Item.ImageList.Images.Add("" + contact.Id, contact.Photo); e.Item.ImageKey = "" + contact.Id; } else { e.Item.ImageKey = "default"; } } But it don't work properly This seems to be a bug in the .NET Framework (that's

How to find out which DataGridView rows are currently onscreen?

被刻印的时光 ゝ 提交于 2019-11-29 12:30:55
问题 In my C# (2010) application I have a DataGridView in Virtual Mode which holds several thousand rows. Is it possible to find out which cells are onscreen at the moment? 回答1: public void GetVisibleCells(DataGridView dgv) { var visibleRowsCount = dgv.DisplayedRowCount(true); var firstDisplayedRowIndex = dgv.FirstDisplayedCell.RowIndex; var lastvisibleRowIndex = (firstDisplayedRowIndex + visibleRowsCount) - 1; for (int rowIndex = firstDisplayedRowIndex; rowIndex <= lastvisibleRowIndex; rowIndex++

How to show icon on all listview items in virtual mode (C#)

孤街醉人 提交于 2019-11-28 08:32:46
问题 I'm using virtual mode of listview to show a larg data. But I don't know how to show image for each item. Who can help me ? I wrote private void ListContact_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { MyContact contact = ContactData.GetMyContact(e.ItemIndex); if (e.Item == null) e.Item = new ListViewItem(contact.ToString()); if (contact.Photo != null) { e.Item.ImageList.Images.Add("" + contact.Id, contact.Photo); e.Item.ImageKey = "" + contact.Id; } else { e.Item

Default implementation for ListView OwnerDraw

ε祈祈猫儿з 提交于 2019-11-28 00:01:52
问题 I have a ListView where I wish to tweak the drawing of items (for example highlighting certain strings in list view itmes), however I don't want to radically alter the way that items are displayed. I have set the OwnerDraw to true and can get my head around how to draw my highlighting effect, however whenever I try to defer to the default implementation to draw the rest of the list view item things go wrong and I'm left with a whole load of graphical problems indicating that actually I've