Datagridview 中的水平滚动
我想在网格中水平滚动(继承自 DataGridView)。 不是使用 Ctrl+滚动倾斜滚轮(鼠标滚轮),而是通过向左或向右推动鼠标滚轮。
首先,我通过在 WndProc 中捕获 WM_MOUSEHWHEEL (0x020E) 消息来尝试,但这只会触发一次(并且只要我按下,我就想继续向左或向右移动)。
我使用 Spy++ 检查我的控件的消息,但没有发现任何有用的东西:$ 我在 Richtextbox(和记事本)上检查了相同的内容,似乎还有另一条消息被触发:WM_HSCROLL(0x0114)。
Richtextbox 不会通过向左或向右推动滚轮来水平滚动,但我可以在 WndProc 函数中捕获 WM_HSCROLL 。我无法在 DataGridView 中执行此操作(消息未到达那里)。
所以我想知道是否有办法让这个东西发挥作用?
问候,
轻松
I want to scroll horizontal in my grid (inherited from DataGridView).
Not with Ctrl+scrolling tiltwheel (mousewheel), but by pushing the mousewheel to the left or the right.
First I tried it by catching the WM_MOUSEHWHEEL (0x020E) message in WndProc, but this fires only once (and I want to keep on moving left or right as long as I push).
I used Spy++ to check the messages of my control, but found nothing usefull :$
I checked the same on a Richtextbox (and notepad) and it seems that there is another message that fires : WM_HSCROLL (0x0114).
The richtextbox doesn't scroll horizontally by pushing the wheel left or right, but I can catch the WM_HSCROLL in the WndProc function. I can't do that in the DataGridView (the Message doesn't arrive there).
So I am wondering if there is a way to get this thing working?
Regards,
TakeItEasy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用水平滚动条作为健全性检查?此处描述:Stack Overflow:鼠标倾斜滚轮
也可能是 DataGridView 需要键盘焦点,这就是 RichEdit 控件滚动的原因,但 DataGridView 不需要。
Have you tried it with a horizontal scroll bar as a sanity check ? Described here: Stack Overflow : Mouse Tilt Wheel
It could also be that the DataGridView needs keyboard focus and that is why the RichEdit control scrolls, but the the DataGridView does not.