DrawLine problem

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
madve
Newbie
Newbie
Posts: 52
Joined: Thu Feb 16, 2006 12:00 am

DrawLine problem

Post by madve » Wed Aug 09, 2006 3:29 pm

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

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Aug 10, 2006 11:54 am

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();
    }
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply