Page 1 of 1

How to disable zoom when Ctrl is pressed ?

Posted: Tue Mar 23, 2004 11:14 am
by 9335454
I have a chart with Horizontal zoom enabled, but I want to do a special
funcion when the Ctrl key is pressed: I want the zoom lines to be drawn,
then I want to clear all points in the selected interval (this is done
setting color clNone to all points), but I dont want the chart to be zoomed.
When Ctrl is not pressed, I want the default behavior.

Is there a way to do it ?

Bruno

Posted: Thu Apr 15, 2004 2:37 pm
by Pep
Hi Bruno,

a trick could be to check if Ctrl key is pressed in the OnMouseDown event :

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  {Check if CONTROL key is down}
  Chart1.Zoom.Allow := (HiWord(GetKeyState(VK_CONTROL)) <> 0);
end;