Board index » cppbuilder » TImage OnMouseMove in a TScrollBox error
TImage OnMouseMove in a TScrollBox error
2008-02-23 03:41:49 AM
I have a TImage inside a TScrollBox. When the mouse
is moved over the TImage, the OnMouseMove code
displays the X and Y coordinates to the user in some
way. This works great until the image height or width is
greater than 32,767. After this the X or Y coordinate wraps
around to a negative number (IE. 32,767 + 1 = -32,768).
The image is 100 pixels wide by 40,000 pixels high. I
have done some searching on the internet and am unable
to determine where the bug is at (in the TImage
OnMouseMove or the TScrollBox)? I know that the size
of one of the variables in the calculation has to be smaller
than a 32bit int in order to wrap around like it does.
What can I do to get the accurate X and Y coordinates when
the X or Y is past 32,767?
Here is the sample code in the OnMouseMove:
void __fastcall TForm1::Image1MouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
Form1->Caption = IntToStr(Y) ; //works great inside
//scroll box until Y is greater than 32,767
I am using BCB C++ 4. Maybe this has been fixed in a later
version of BCB? Is there any way to work around this error
to get the correct coordinates?