Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to dynamically divide the scale such as min =50 and max=100 and scale value=55 then scale showing 95 as its taking the scale as 0 to 100.
Posted
Comments
phil.o 25-Oct-11 7:53am    
Show us some code so that we can figure out what's going on...
Abhinav S 25-Oct-11 8:11am    
There are a number of third parties that provide gauge controls.
You can check on the product's site for documentation / tutorials.

1 solution

C#
public static double Scale(double value)
{
    double min = 50.0;
    double max = 100.0;
    if(min == max)
        return 100.0;
    return 100*(value - min)/(max - min);
}
 
Share this answer
 
Comments
Espen Harlinn 25-Oct-11 16:40pm    
That seems about right :)
Simon Bang Terkildsen 25-Oct-11 17:01pm    
I hope so, or I'm gonna demand the money, my mom paid for 2 years of private school, back! :P
Of course I would keep them myself, she doesn't know how to use them anyway XD

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900