且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何触发轨迹栏的OnValueChanged事件

更新时间:2023-12-06 14:43:46

首先:为什么要覆盖WndProc?我建议覆盖OnPaint方法。

然后:您的自定义控件应该具有像Base-Control这样的Value-Property。现在......如果您的值发生变化(将其与last_Value - 另一个变量 - 可能在您的Value-Property的Setter中进行比较),则调用OnValueChanged-Method。此方法将引发事件。
At first : why do you override the WndProc ? I would suggest to override the OnPaint-method.
Then : your customized Control should have a Value-Property like the Base-Control. Now ... if your value changes (compare it with the last_Value - another variable - perhaps in the Setter of your Value-Property) you call the OnValueChanged-Method. This Method will raise the Event.