简体   繁体   English

.Net中有关WinForms TrackBar控件的问题

[英]Question about WinForms TrackBar control in .Net

Does anyone know the millisecond interval, used by the framework trackbar, between calling the ValueChanged event when moving the grip with a mouse? 有谁知道框架轨迹栏使用鼠标移动夹点时调用ValueChanged事件之间的毫秒间隔?

I've implemented my own trackbar and I'd like the behaviour to be consistent with what the user expects. 我已经实现了自己的跟踪栏,并且希望其行为与用户期望的一致。

I've had a look in reflector but it's one of those controls where most of the implementation is not viewable. 我看过反射器,但它是其中大多数实现不可见的控件之一。

ETA: Actually, thinking about it, it's not as simple as that. ETA:实际上,考虑一下,事情并非如此简单。 For small changes, the TrackBar is raising the event for every change. 对于较小的更改,TrackBar会为每个更改引发事件。 However, if you make a large fast change with the grip, it will not raise the event for every step. 但是,如果使用握柄进行较大的快速更改,则不会在每个步骤中引发该事件。 Just wondering exactly how the framework does this? 只是想知道框架是如何做到的?

Thanks 谢谢

The TrackBar control is a wrapper around the native Windows Trackbar control. TrackBar控件是本机Windows Trackbar控件的包装。 You won't find any relevant code. 您将找不到任何相关代码。

This is almost certainly controlled by WM_MOUSEMOVE messages, if you move the mouse fast, it skips reporting back some intermediate positions. 这几乎可以肯定是由WM_MOUSEMOVE消息控制的,如果快速移动鼠标,它将跳过向后报告某些中间位置的过程。 Your custom control should therefore act exactly like TrackBar. 因此,您的自定义控件应与TrackBar完全一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM