namespace Mous
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
((Control)this).MouseWheel += new MouseEventHandler(Form1_MouseWheel);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
void Form1_MouseWheel(object sender, MouseEventArgs e)
{
try
{
int i = Convert.ToInt32(textBox1.Text);
if (textBox1.Bounds.Contains(e.Location)) //判断鼠标所在的地方是否在控件上
{
if (e.Delta.ToString() == "120")
{
i++;
textBox1.Text = i.ToString();
}
else
{
i--;
textBox1.Text = i.ToString();
}
}
}
catch { }
}
}
}