Page 1 of 1

DrawLine problem

Posted: Wed Aug 09, 2006 3:29 pm
by 9790349
Hi,

It seems that there is not effect setting DrawLine tool Pen properties I always get a solid, 1 point width black line.

I used the following code:

Code: Select all

  // 
  // DrawLine1
  // 
  Self.DrawLine1.EnableSelect := False;
  // 
  // DrawLine1.Pen
  // 
  Self.DrawLine1.Pen.Color := System.Drawing.Color.Brown;
  Self.DrawLine1.Pen.Style := System.Drawing.Drawing2D.DashStyle.DashDot;
  Self.DrawLine1.Pen.Width := 4;

Code: Select all

procedure TWinForm.TChart1_Click(sender: System.Object; e: System.EventArgs);
var
  P : Point;
  l : Steema.TeeChart.Tools.DrawLineItem;
begin
  Debug.Write(Cursor.Position.X.ToString);
  P := TChart1.PointToClient( Cursor.Position );
  Debug.Write('x ' + P.X.ToString);

  DrawLine1.Lines.Clear;

  l := Steema.TeeChart.Tools.DrawLineItem.Create(drawLine1);;

  l.StartPos.X := tChart1.Axes.Bottom.CalcPosPoint(P.X);
  l.StartPos.Y := 0;
  l.EndPos.X := tChart1.Axes.Bottom.CalcPosPoint(P.X);
  l.EndPos.Y := TChart1.Axes.Left.Maximum;

  TChart1.Invalidate;
end;
Best regards,

Gabor Varga

Posted: Thu Aug 10, 2006 11:54 am
by Chris
Hello,

OK, I've been able to reproduce this one and have fixed it for the maintenance release due out in September.

In the meantime you can partially work around this problem using the following code:

Code: Select all

    private void tChart1_MouseUp(object sender, MouseEventArgs e)
    {
      for (int i = 0; i < drawLine1.Lines.Count; ++i)
      {
        drawLine1.Lines[i].Pen.Assign(drawLine1.Pen);
      }
      drawLine1.Invalidate();
    }