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