473,473 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Slow listview

Hi
I am using Listview and inherited listview control overriding WndProc
& PreProcessMessage in ListView.

I need this to customize listview to display only the page the user
scrolls to. Since i am populating listview with more than 200,000
items. It is too slow and tried virtual listview. But that doesnot
allow me to add images in the listview. So now trying to list only the
page user scrolls to.

Tried to keep track of the current page by simple logic. Now want to
know whether is there anyother way of keeping track of the PAGE THE
USER SCROLLS to. I know in advance the number of items in the
listview. Also know the no. of items in each page.

Wot change i need to do to keep track of the current page in
listview??

Also let me know is there any way to speed listview. I tried sorting
to be false and also tried lockwindowupdate api. It had only little
effect. Then also tried virtual listview.. Its performance is very
good but could not add images. Pls let me know how to speeed listview
for nearly 200,000 items(adding images too).

Will this logic of listing the page only the user requested scrolled
to will work (without flickering??)..

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace CtrPagingListView
{
public class CtrPagingListView : System.Windows.Forms.ListView

{

const int WM_HSCROLL = 0x0114;
const int WM_VSCROLL = 0x0115;
protected const int WM_KEYDOWN = 0x0100;
protected const int VK_LEFT = 0x0025;
protected const int VK_UP = 0x0026;
protected const int VK_RIGHT = 0x0027;
protected const int VK_DOWN = 0x0028;
public int i = 11;
private System.ComponentModel.Container components = null;

// store the item count to prevent the call to
SendMessage(LVM_GETITEMCOUNT)
private int itemCount = 0;
public int ItemCount
{
get { return itemCount; }
set
{
itemCount = value;
int result;
result = WindowsFunction.SendMessage(
this.Handle,
(int)ListViewMessages.LVM_SETITEMCOUNT,
itemCount,
0);
}
}

public CtrPagingListView()
{
InitializeComponent();

}

protected override void WndProc(ref System.Windows.Forms.Message
msg)
{

int NUMLINES = 5000;

int numLinesPerpage = 12;

if(msg.Msg == WM_HSCROLL)
{System.Windows.Forms.MessageBox.Show("WM_HSCROLL
message","sdf");}

if(msg.Msg == WM_VSCROLL)
{
System.IntPtr param = msg.WParam;
switch ((int)param)
{
case 7:
System.Windows.Forms.MessageBox.Show("SB_BOTTOM message" +
(NUMLINES - numLinesPerpage) + "to" + NUMLINES);
i = NUMLINES - numLinesPerpage;
// nVscrollInc = nVscrollMax - nVscrollPos;
break;

case 0:
//nVscrollInc = -1;
System.Windows.Forms.MessageBox.Show("SB_linwup WM_HSCROLL
message" + i + " to " + (i - 1));
i = i - 1;
break;

case 1:
//nVscrollInc = 1;
System.Windows.Forms.MessageBox.Show("SB_LINEdown message" + i +
"to" + (i + 1));
i = i + 1;
break;

case 2:
// nVscrollInc = min (-1, -cyClient / cyChar);
System.Windows.Forms.MessageBox.Show("SB_PAGEUP message"+ i +
"to" + (i-numLinesPerpage)); i = i-numLinesPerpage;
break;

case 3:
// nVscrollInc = max (1, cyClient / cyChar);
System.Windows.Forms.MessageBox.Show("SB_PAGEDOWN message" + i +
" to " + (i+numLinesPerpage));
i = i+numLinesPerpage;
break;

case 5:
// nVscrollInc = LOWORD (lParam) - nVscrollPos;
System.Windows.Forms.MessageBox.Show("SB_THUMBTRAC K
message","sdf");
break;

}
} base.WndProc(ref msg);
}
protected override void OnMouseUp(MouseEventArgs e)
{
System.Windows.Forms.MessageBox.Show("ONMOusedown" + e.X + " Delta
" + e.Delta);
System.Windows.Forms.MessageBox.Show("ONMOusedown" + e.Y);
base.OnMouseUp(e);
}

public override bool PreProcessMessage(ref
System.Windows.Forms.Message msg)
{
//Convert key code to a .NET Keys structure
// Convert key code to a .NET Keys structure
Keys keyData = ((Keys) (int) msg.WParam) | ModifierKeys;
Keys keyCode = ((Keys) (int) msg.WParam);

// handle message
if (keyData == Keys.Next)
{
System.Windows.Forms.MessageBox.Show("next page" + i + "to" + (i
+ 9));

i = i + 9;
}
else if (keyData == Keys.Prior)
{
System.Windows.Forms.MessageBox.Show("prev message" + i + "to" +
(i - 9));

i = i - 9;

}
else if (keyData == Keys.Up)
{
System.Windows.Forms.MessageBox.Show("UP" + i + "to" +( i - 1));

i = i - 1;
}
else if (keyData == Keys.Down)
{
System.Windows.Forms.MessageBox.Show("DOWN" + i + "to" + (i +
1));
i = i + 1;
}
else if (keyData == Keys.Left)
{
System.Windows.Forms.MessageBox.Show("Left");

}
else if (keyData == Keys.Right)
{
System.Windows.Forms.MessageBox.Show("Right");

} return base.PreProcessMessage(ref msg);
}


}
}
Nov 22 '05 #1
0 1811

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Anushya | last post by:
Hi I am using Listview and inherited listview control overriding WndProc & PreProcessMessage in ListView. I need this to customize listview to display only the page the user scrolls to. Since i...
4
by: ?BOT | last post by:
Why is the following code so slow? I have a listView that must refresh it's processes data every 3 seconds. However, this sometimes goes beyond 5 seconds and crashes the application. I have tries...
2
by: cybertof | last post by:
Hello, Is there a solution to the following problem : When filling a listview (30 columns) with around 5000 items, it can take easily 10 sec for the listview to be filled. I have used...
21
by: TryingLikeHeck | last post by:
I have an application that uses a LIstView. Maybe 100 items each with 20 subitems. The app looks at eack item and subitem twice. I.e., it scans the entire set of data item1, sub1,sub2,......
14
by: Marten Van Keer | last post by:
Given two .NET applications A and B. These two application communicate with each other by using an object C: A --> C <-- B Application A has a listview. This listview can be refreshed by...
2
by: johnb41 | last post by:
In my app, I need to open up a multipage tiff file, and also display it's thumbnail images IN HIGH QUALITY. (High Quality meaning anti-aliased, and looking good; not rough and pixely) The...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.