C# 简单问题

wenjunsu 2010-11-30 05:37:28
程序在右下角有个图标,我想 把鼠标放在图标上的时候 滚动滚轮 向前滚 变量加1 向后滚 变量减一
如何实现??实现就可以。不论方法
请看清楚红色的部分
在线等。对了立即给分
...全文
156 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-11-30
  • 打赏
  • 举报
回复
NotifyIcon 没有MouseWheel事件
ZengHD 2010-11-30
  • 打赏
  • 举报
回复
C#提供的NotifyIcon控件没有MouseWheel事件,而且还是sealed,试试能不能用Shell_NotifyIcon了
lkr2380869 2010-11-30
  • 打赏
  • 举报
回复
int count=0;
//注册事件:
this.右下角的图标控件.MouseWheel += new MouseEventHandler(右下角的图标控件_MouseWheel);

private void 右下角的图标控件_MouseWheel(object sender, MouseEventArgs e)
{
count+=e.Delta /120;
}
wenjunsu 2010-11-30
  • 打赏
  • 举报
回复
我说的是在右下角的活动图标上 滚动滚轮 这不是在右下角 指定的图标上滚动

[Quote=引用 3 楼 zenghd 的回复:]
C# code
private const int WM_MOUSEWHEEL = 0x020A;
private int count1 = 0, count2 = 0;

protected override void WndProc(ref Message m)
{
if (m.Msg == W……
[/Quote]
wenjunsu 2010-11-30
  • 打赏
  • 举报
回复
1楼的说法 让我汗颜
二楼的 我看得懂 不过没有帮助
3楼的 看看再说
4楼的 经常看到这种混分的
ZengHD 2010-11-30
  • 打赏
  • 举报
回复
        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);
}
xiehuanxie 2010-11-30
  • 打赏
  • 举报
回复
右下角的小图标不能响应滚轮事件。


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.

jiangjun110120 2010-11-30
  • 打赏
  • 举报
回复
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
int temp = e.Delta;
}
根据temp判断

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧