/// <summary> /// Initialize a new instance of the KryptonTrackBar class. /// </summary> public KryptonTrackBar() { // Default values _autoSize = true; _requestedDim = 0; // Create the palette storage StateCommon = new PaletteTrackBarRedirect(Redirector, NeedPaintDelegate); OverrideFocus = new PaletteTrackBarRedirect(Redirector, NeedPaintDelegate); StateDisabled = new PaletteTrackBarStates(StateCommon, NeedPaintDelegate); StateNormal = new PaletteTrackBarStates(StateCommon, NeedPaintDelegate); StateTracking = new PaletteTrackBarPositionStates(StateCommon, NeedPaintDelegate); StatePressed = new PaletteTrackBarPositionStates(StateCommon, NeedPaintDelegate); // Create the override handling classes _overrideNormal = new PaletteTrackBarStatesOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride); _overrideTracking = new PaletteTrackBarPositionStatesOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTrackBarPositionStatesOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride); // Create the view manager instance _drawTrackBar = new ViewDrawTrackBar(_overrideNormal, StateDisabled, _overrideTracking, _overridePressed, NeedPaintDelegate); _drawTrackBar.ValueChanged += OnDrawValueChanged; _drawTrackBar.Scroll += OnDrawScroll; _drawTrackBar.RightToLeft = RightToLeft; ViewManager = new ViewManager(this, _drawTrackBar); }
/// <summary> /// Initialize a new instance of the ViewDrawTrackBar class. /// </summary> /// <param name="stateNormal">Referenece to normal state values.</param> /// <param name="stateDisabled">Referenece to disabled state values.</param> /// <param name="stateTracking">Referenece to tracking state values.</param> /// <param name="statePressed">Referenece to pressed state values.</param> /// <param name="needPaint">Delegate used to request repainting.</param> public ViewDrawTrackBar(PaletteTrackBarStatesOverride stateNormal, PaletteTrackBarStates stateDisabled, PaletteTrackBarPositionStatesOverride stateTracking, PaletteTrackBarPositionStatesOverride statePressed, NeedPaintHandler needPaint) : base(stateNormal.Back) { // Default state StateNormal = stateNormal; StateDisabled = stateDisabled; StateTracking = stateTracking; StatePressed = statePressed; Padding = Padding.Empty; _orientation = Orientation.Horizontal; _value = 0; _minimum = 0; _maximum = 10; _smallChange = 1; _largeChange = 5; _tickFreq = 1; _tickStyle = TickStyle.BottomRight; TrackBarSize = PaletteTrackBarSize.Medium; VolumeControl = false; _needPaint = needPaint; // Create drawing/layout elements TrackPosition = new ViewDrawTP(this); _ticksTop = new ViewDrawTrackTicks(this, true); _ticksBottom = new ViewDrawTrackTicks(this, false); _ticksTop.Visible = false; _ticksBottom.Visible = true; // Connect up layout structure _layoutTop = new ViewLayoutDocker { { _ticksTop, ViewDockStyle.Top }, { TrackPosition, ViewDockStyle.Top }, { _ticksBottom, ViewDockStyle.Top } }; _layoutTop.Padding = Padding; Add(_layoutTop); }