int ToScrollPos(long value)
{
int max = 65535;
if(_scrollVmax < max)
return (int)value;
else
{
double valperc = (double)value / (double)_scrollVmax * (double)100;
int res = (int)Math.Floor((double)max / (double)100 * valperc);
res = (int)Math.Max(_scrollVmin, res);
res = (int)Math.Min(_scrollVmax, res);
return res;
}
}