Draw the line streight as side line?

Hi all,

In most common auto cad software you can press shift or alt key before
you starts to draw and the line will be horizontal or vertical depending
on which way you move the mouse. It's the very same feature as sideline except for the little "L" at the end of the line.

I have almost solved it by this way below, yeah you have to decide if the user starts drawing horizontal or vertical first) but the line flickers so it will not be streight but instead it looks like a step :( So it's not exactly working as I would like it to do :)

private
  AltKeyPressedWhenDrawing: Boolean

procedure TForm1.atDiagramMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  AltKeyPressedWhenDrawing := GetKeystate(VK_MENU) and $8000 = $8000;
  if AltKeyPressedWhenDrawing then
  begin
    GetCursorPos(MousePosXY);
  end;
end;

procedure TForm1.atDiagramMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  LineRect : TRect;
begin
  if AltKeyPressedWhenDrawing then
  begin
    LineRect.Top := atDiagram.Top;
    LineRect.Left := MousePosXY.x;
    LineRect.Bottom := Screen.Height;
    LineRect.Right := MousePosXY.x;

    ClipCursor(@LineRect) ;
  end;
end;

procedure TForm1.atDiagramMouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ClipCursor(nil);
  AltKeyPressedWhenDrawing := False;
end;

Any Ideas?

Kind Regards,
Marco.

Does not anyone have any idea how to solve this with Diagram studio?
I want to draw a line straight when I hold the alt or shift key down at the same time.

Anyone?