DemiDimi
DemiDimi

Reputation: 11

Range Slider with ETO form

A range slider is a slider with two "knobs" and the second "knob" must always have a value > that of the first "knob".

What would be the best way to achieve a range slider in ETO forms? looks like the Slider : Control class does not expose enough information to create a slider with double Knobs.

Perhaps one way to "fake" it is to put two slider objects side by side, where the value of the first slider becomes the min value of the second slider (this will require some resizing too)?

If we were to create a custom double slider object, http://pages.picoe.ca/docs/api/html/T_Eto_Forms_Slider.htm

Upvotes: 0

Views: 150

Answers (1)

Curtis
Curtis

Reputation: 1602

To create custom controls in Eto.Forms, you can use the Drawable class, which gives you a Paint event that you can draw the UI you need, handle mouse events, etc. Setting CanFocus to true allows it to be focused so you can handle key events. For example:

public class RangeSlider : Drawable
{
  public RangeSlider()
  {
    CanFocus = true;

    Size = new Size(200, 20);
  }

  protected override void OnPaint(PaintEventArgs e)
  {
    base.OnPaint(e);
    // draw the range slider using e.Graphics
  }
}

Upvotes: 1

Related Questions