Possible to keep line on Chart drawn by Cursor Tool?
Posted: Thu Dec 16, 2010 4:03 am
Hello,
Regarding Cursor Tool set up like this:
with Chart1.Tools.Add(TCursorTool) as TCursorTool do
begin
FollowMouse := True;
ScopeStyle := scsEmpty;
Pen.Visible := False;
Series := Chart1[0]; //A series must be assigned to show cross hair with cursor tool.
end;
As you can see, the cross hair is normally not drawn, as Pen.Visible is false.
I only show the cross hair when the mouse is pressed:
procedure TfrDataLogger.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Chart1.Tools.Items[0].Pen.Visible := True;
end;
When the user is moving the mouse, of course the cross hair is then following the mouse as planned.
My question is:
Is there a way to keep the cross hair that is drawn the moment the mouse is pressed, so it is not "ereased" when the mouse is moving to another xy position?
I need this function for a measuring tool, that shows the difference between the point where the mouse was pressed, and the actual mouse position.
I tried it with drawing the first cross hair manually, but it seems like I'm running into repainting issues again like I have had previously with others stuff.
What could be the right way to do this?
Thanks for any suggestions in advance
Regarding Cursor Tool set up like this:
with Chart1.Tools.Add(TCursorTool) as TCursorTool do
begin
FollowMouse := True;
ScopeStyle := scsEmpty;
Pen.Visible := False;
Series := Chart1[0]; //A series must be assigned to show cross hair with cursor tool.
end;
As you can see, the cross hair is normally not drawn, as Pen.Visible is false.
I only show the cross hair when the mouse is pressed:
procedure TfrDataLogger.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Chart1.Tools.Items[0].Pen.Visible := True;
end;
When the user is moving the mouse, of course the cross hair is then following the mouse as planned.
My question is:
Is there a way to keep the cross hair that is drawn the moment the mouse is pressed, so it is not "ereased" when the mouse is moving to another xy position?
I need this function for a measuring tool, that shows the difference between the point where the mouse was pressed, and the actual mouse position.
I tried it with drawing the first cross hair manually, but it seems like I'm running into repainting issues again like I have had previously with others stuff.
What could be the right way to do this?
Thanks for any suggestions in advance