本文介绍了如何触发轨迹栏的OnValueChanged事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绘制了trackbar组件并将其命名为cumstomtrackbar,它继承自trackbar类。

但我发现customtrackbar无法触发OnValueChanged事件,如何触发它?

一些相关的代码如下:



I drawed trackbar component and named it as cumstomtrackbar,it inherit from trackbar class.
But I find that the customtrackbar can't tigger OnValueChanged event,how to trigger it ?
some releated code as below:

  public class CustomTrackBar:System.Windows.Forms.TrackBar
 {
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case WM.WM_PAINT:
                    if (true)
                    {
                        PAINTSTRUCT ps = new PAINTSTRUCT();
                        BeginPaint(m.HWnd, ref ps);
                        DrawTrackBar(m.HWnd);
                        ValidateRect(m.HWnd, ref ps.rcPaint);
                        EndPaint(m.HWnd, ref ps);
                    }
                    else
                    {
                        base.WndProc(ref m);
                    }
                    break;
                default:
                    base.WndProc(ref m);
                    break;
            }
        }
}

推荐答案


这篇关于如何触发轨迹栏的OnValueChanged事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 09:02