I'm trying to create a custom numericUpDown control. I'm trying to add text to the numericUpDown and I got it working good. But, now I want to find a way to select only the number when clicking in the control, because at this moment when I "edit" the value manually, I can erase the unit I added into the control. I found this control in a software on google that is like a "ranged" numericUpDown. It works like the way I need, it has been possible to click and select only the numbers. When you click in the text, it should select the number to be edited and not the text:
This is what I have now:
public class RangedNumericUpDown : NumericUpDown
{
public int ValueMin = 0;
public int ValueMax = 10;
public RangedNumericUpDown()
{
}
protected override void UpdateEditText()
{
if(this.Text != this.ValueMin + " to " + this.ValueMax)
this.Text = this.ValueMin + " to " + this.ValueMax;
}
}
I couldn't find any custom control for windows forms like this, and I guess it is possible to create something like that image.
Well, you don't have enough code. Not so sure I'd recommend this, moving the "focus" from one value to another isn't exactly very intuitive. You'll get better UI from simply using two NUDs.
Anyhoo, some code to play with: