int ToScrollMax(long value) { long max = 65535; if(value > max) return (int)max; else return (int)value; }