There is a code for your control for Windows Form
Looks like a progress bar.
public partial class Slider : UserControl { public Slider() { InitializeComponent(); this.ForeColor = SystemColors.Highlight; } protected float percent = 0.0f; protected float maximumValue = 0.0f; public float Value { get { return percent; } set { if (value < 0) value = 0; //else if (value > 100) value = 0; percent = value; this.Invalidate(); } } public float Maximum { get { return maximumValue; } set { maximumValue = value; this.Invalidate(); } } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Brush br = new SolidBrush(this.ForeColor); LinearGradientBrush lg = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height),Color.Cyan, Color.Blue, LinearGradientMode.ForwardDiagonal); int width = (int)((percent / maximumValue) * this.Width); e.Graphics.FillRectangle(br, 0, 0, width, this.Height); e.Graphics.FillRectangle(lg, 0, 0, width, this.Height); br.Dispose();lg.Dispose(); } } } It was made for a video player to display video playback.
So I wanted to redo it under WPF, but in WPF there is no OnPaint function.
I read that there is an OnRender method in WPF as an analogue, but I didn’t understand exactly how to do it.
Tell me, please, how to do it.
