March 20th, 2004, 08:48 AM
TShape problem in Borland C++
I have a TShape object on a form and I want to store itīs Top and Left positions. Then if I add one more shape object to my app and want it to have the same position as the first shape, how can I do it easily??
NOT like this:
I need a simple solution like this one:
Shape2->Top = Shape1->Top;
Shape2->Left = Shape1->Left;
I have tried to use ClientToScreen and ClientOrigin and stuff like that to get the point of the shape, but I donīt know how to use them.
Shape2->Position = Shape1->Position;
March 21st, 2004, 09:48 AM
Why not? If you really need it in one line, you could derive your own TMyShape from T(Custom?)Shape and add eg. "TPoint ::GetPosition()" and "SetPosition(TPoint)" methods, but this is probably too much overhead compared to using the two lines from above...
Originally Posted by Mattiaz
August 29th, 2004, 06:04 AM
SetBounds(int ALeft, int ATop, int AWidth, int AHeight);
Sets the Left, Top, Width, and Height properties all at once.