I and wanting to draw a line with a very pronounced arrow using the Graphics3D object. I tried using the g.Arrow method but when I specify a 7x7 pixel arrow the line is real thick. Why? And is there another way of doing this? I cannot use a DrawLine in this case as I am doing all my drawing in the AfterDraw event.
Thanks,
Kevin
Drawing an arrow at the end of a line using Graphics3D
Hi WD_Gordon,
We doesn't understand exactly do you want. Please, could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page. Or it tells you what you want exactly.
On the other hand, TeeChart have ArrowSeries. This draw arrows using two points for example: x0,y0 (p0), x1 ,y1 (p1). Also you can see in TeeChart .NET demo arrow example AllFeatures/Welcome !\Chart styles\Standard\Arrow example, could be interesting for you.
Thanks
We doesn't understand exactly do you want. Please, could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page. Or it tells you what you want exactly.
On the other hand, TeeChart have ArrowSeries. This draw arrows using two points for example: x0,y0 (p0), x1 ,y1 (p1). Also you can see in TeeChart .NET demo arrow example AllFeatures/Welcome !\Chart styles\Standard\Arrow example, could be interesting for you.
Thanks
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Sandra,
I don't need the ArrowSeries, all I am doing is drawing in the AfterDraw event. I uploaded an image named Fibonacci_Arrow.JPG, to show you what I am talking about.
The arrow at the top was drawn using the arrow method as follows:
g.Arrow(true, new Point(topLeft.X, topLeft.Y), new Point(bottomRight.X, bottomRight.Y), 10, 10, 0);
As you can see it paints a thick line as well.
Thanks,
Kevin
I don't need the ArrowSeries, all I am doing is drawing in the AfterDraw event. I uploaded an image named Fibonacci_Arrow.JPG, to show you what I am talking about.
The arrow at the top was drawn using the arrow method as follows:
g.Arrow(true, new Point(topLeft.X, topLeft.Y), new Point(bottomRight.X, bottomRight.Y), 10, 10, 0);
As you can see it paints a thick line as well.
Thanks,
Kevin
Hi Kevin,
We suggest a similar code as next example, in AfterDraw event:
Hope this helps!
We suggest a similar code as next example, in AfterDraw event:
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Point p1 = new Point(tChart1.Chart.ChartRect.Left,tChart1.Chart.ChartRect.Top);
Point p2 = new Point(tChart1.Chart.ChartRect.Right, tChart1.Chart.ChartRect.Bottom);
Point p3 = new Point(tChart1.Chart.ChartRect.Right-6, tChart1.Chart.ChartRect.Bottom -4) ;
g.Brush.Color = Color.Black;
g.Line(p1, p2);
g.Arrow(true,p3,p2, 10, 10, 0);
}
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Kevin,
Here you have an example of how you could draw a thin line with a big head:
Here you have an example of how you could draw a thin line with a big head:
Code: Select all
public partial class Form1 : Form
{
bool DrawLine;
Point headStartPoint, fromPoint, toPoint;
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
chartController1.Chart = tChart1;
fromPoint = new Point();
toPoint = new Point();
headStartPoint = new Point();
DrawLine = false;
tChart1.Zoom.Allow = false;
tChart1.Aspect.View3D = false;
tChart1.MouseDown +=new MouseEventHandler(tChart1_MouseDown);
tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
fromPoint.X = e.X;
fromPoint.Y = e.Y;
DrawLine = true;
}
}
void tChart1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
DrawLine = false;
}
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (DrawLine)
{
toPoint.X = e.X;
toPoint.Y = e.Y;
tChart1.Refresh();
}
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (DrawLine)
{
g.Brush.Color = Color.Black;
g.Line(fromPoint, toPoint);
int dx = toPoint.X - fromPoint.X;
int dy = fromPoint.Y - toPoint.Y;
if (Math.Sqrt(dx * dx + dy * dy) > 7)
{
if (dx == 0)
{
if (dy > 0)
{
headStartPoint.X = toPoint.X;
headStartPoint.Y = toPoint.Y + 6;
}
else
{
headStartPoint.X = toPoint.X;
headStartPoint.Y = toPoint.Y - 6;
}
}
else
{
headStartPoint.X = (int)(toPoint.X - (6 * Math.Cos(Math.Atan2(dy, dx))));
headStartPoint.Y = (int)(toPoint.Y + (6 * Math.Sin(Math.Atan2(dy, dx))));
}
g.Arrow(true, headStartPoint, toPoint, 10, 10, 0);
}
}
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |