I have a TrackBar with values [-100,100]
this values are used in some function that accept float values between 0 and 20 (I guess)..
when TrackBar.Value = [-100, 1]
that value must converted to [0.0, 1.0]
when TrackBar.Value = ( 1, 100]
that value must converted to [1.1, 20]
what`s the formula to convert that?
I`m working at it from a while... and nothing...
Loading
Hiren SoniPosted Dec 8, 2009, 7:42 AM
double d = ( (trackbar1.value/10) + 10 );
here pass value of variable d in whichever function you want to pass
Kirtan PatelPosted Dec 8, 2009, 9:19 AM
What do you mean by [1,100] as track bar have only one Value at a time ??
private void trackBar1_Scroll(object sender, EventArgs e)
{
label1.Text = ((float)Math.Abs(trackBar1.Value)/10).ToString();
}
Hiren SoniPosted Dec 8, 2009, 7:21 AM