i`m creating a rectangular component from TShape using Delphi6. when i add this cmponent to my form i want it the cursor icon to change.If the cursor is then moved in from the right or left edge of my component by 'x' pixels (for instance say 5px) i would like to change the cursor again. This means i would have a 5px border at the left and right sides of my component.I have created a private proc for the windows message WM_MOUSEMOVE and I have got what i want.The PROC is:
procedure TIBTTimeBandRect.WMMouseMove(var Message: TWMMouseMove);
intTBLeft:Integer; //TimeBands left cooordinate in reference to the screen as a whole
intTBLeft:=Parent.Left+Self.Left+4; //4 for Forms Border
if ((mouse.CursorPos.X)>(intTBLeft+5))and ( ( (intTBLeft+self.Width)-5)>mouse.CursorPos.X) then cursor:= crSizeAll
else cursor:= crSizeWE;
The problem is should i place this component under aother component i.e. a frame etc. it won't work as intTBLeft relies on the forms 'Left' property. How can i adapt it so that it will work no matter what form or component i place my component on i.e. perhaps changing the 'self.left' property to a 'cursorPos' equivalent value.
i`m relatively new to Delphi and would be grateful for any help on this matter.