一、自定义鼠标事件:
private void my_MouseWheel(object sender, MouseEventArgs e)
{
System.Drawing.Point pt = this.Location;
int LeftBorder = displayResult.Location.X;
int rightBorder = displayResult.Location.X + displayResult.Size.Width;
int topBorder = displayResult.Location.Y;
int bottomBorder = displayResult.Location.Y + displayResult.Size.Height;
if (e.X > LeftBorder && e.X < rightBorder && e.Y > topBorder && e.Y < bottomBorder)
{
MouseEventArgs newe = new MouseEventArgs(e.Button, e.Clicks, e.X - pt.X, e.Y - pt.Y, e.Delta);
displayResult.HSmartWindowControl_MouseWheel(sender, newe);
}
}
二、控件下调用自定义鼠标事件
private void displayResult_Load(object sender, EventArgs e)
{
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.my_MouseWheel);
}