Even in your button click event, your trying to create panels that top value exceeds the limits of smallint.
Yes, but that's what this thread is all about.
I appreciate this does not solve your problem, but it shows what is causing your design to fail.
Not really. What I wanted to show with this demo is that I'm able to
add panels whose top values exceed the limits of smallint without any problems. I can select them, I can change their color or caption and I can even read their top values. Everything is fine, as if there is no 15 (or 16) bit limitation. Problems arise only if I want to change their position subsequently.
But, okay, seems as if I have to live with that.