右下角的小图标不能响应滚轮事件。 BalloonTipClicked Occurs when the balloon tip is clicked. BalloonTipClosed Occurs when the balloon tip is closed by the user. BalloonTipShown Occurs when the balloon tip is displayed on the screen. Click Occurs when the user clicks the icon in the notification area. Disposed Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.) DoubleClick Occurs when the user double-clicks the icon in the notification area of the taskbar. MouseClick Occurs when the user clicks a NotifyIcon with the mouse. MouseDoubleClick Occurs when the user double-clicks the NotifyIcon with the mouse. MouseDown Occurs when the user presses the mouse button while the pointer is over the icon in the notification area of the taskbar. MouseMove Occurs when the user moves the mouse while the pointer is over the icon in the notification area of the taskbar. MouseUp Occurs when the user releases the mouse button while the pointer is over the icon in the notification area of the taskbar.
private const int WM_MOUSEWHEEL = 0x020A; private int count1 = 0, count2 = 0; protected override void WndProc(ref Message m) { if (m.Msg == WM_MOUSEWHEEL) { int iParam = (m.WParam.ToInt32()) >> 16; if (iParam == 120) { count1++; } else if (iParam == -120) { count2++; } int xPos = m.LParam.ToInt32() & 0x0000FFFF; int yPos = (m.LParam.ToInt32()) >> 16; this.Text = string.Format("向前滚动{0}次,向后滚动{1}次,坐标x={2},y={3}", count1, count2,xPos,yPos); } base.WndProc(ref m); }
int count=0; //注册事件: this.右下角的图标控件.MouseWheel += new MouseEventHandler(右下角的图标控件_MouseWheel);private void 右下角的图标控件_MouseWheel(object sender, MouseEventArgs e) { count+=e.Delta /120; }
{
int temp = e.Delta;
}
根据temp判断
BalloonTipClicked Occurs when the balloon tip is clicked.
BalloonTipClosed Occurs when the balloon tip is closed by the user.
BalloonTipShown Occurs when the balloon tip is displayed on the screen.
Click Occurs when the user clicks the icon in the notification area.
Disposed Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
DoubleClick Occurs when the user double-clicks the icon in the notification area of the taskbar.
MouseClick Occurs when the user clicks a NotifyIcon with the mouse.
MouseDoubleClick Occurs when the user double-clicks the NotifyIcon with the mouse.
MouseDown Occurs when the user presses the mouse button while the pointer is over the icon in the notification area of the taskbar.
MouseMove Occurs when the user moves the mouse while the pointer is over the icon in the notification area of the taskbar.
MouseUp Occurs when the user releases the mouse button while the pointer is over the icon in the notification area of the taskbar.
private int count1 = 0, count2 = 0; protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEWHEEL)
{
int iParam = (m.WParam.ToInt32()) >> 16;
if (iParam == 120)
{
count1++;
}
else if (iParam == -120)
{
count2++;
} int xPos = m.LParam.ToInt32() & 0x0000FFFF;
int yPos = (m.LParam.ToInt32()) >> 16; this.Text = string.Format("向前滚动{0}次,向后滚动{1}次,坐标x={2},y={3}", count1, count2,xPos,yPos);
}
base.WndProc(ref m);
}
//注册事件:
this.右下角的图标控件.MouseWheel += new MouseEventHandler(右下角的图标控件_MouseWheel);private void 右下角的图标控件_MouseWheel(object sender, MouseEventArgs e)
{
count+=e.Delta /120;
}