using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace WindowsApplication4
{ public class Form1 : System.Windows.Forms.Form
{
private myListView listView1;
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.listView1 = new myListView();
this.listView1.Location = new System.Drawing.Point(248, 168);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(72, 88);
this.listView1.TabIndex = 4;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(496, 293);
this.Controls.Add(this.listView1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main() 
{
Application.Run(new Form1());
} private void Form1_Load(object sender, System.EventArgs e)
{
for (int i=0;i<10;i++)
listView1.Items.Add("dddd");
}

} public class myListView:ListView
{
protected override void WndProc(ref Message m) 
{
base.WndProc(ref m);
switch (m.Msg)
{
case 0x0014:
MessageBox.Show("Hscroll message");
break;
case 0x0015:
MessageBox.Show("Vscroll message");
break;                
}
}
}
}