Page 1 of 1

DrawLine problem

Posted: Mon Oct 25, 2010 9:43 am
by 9535061
Hello,
I am now trying with Teechart ActiveX Pro 8 version and seems that the older problems are resolved.
But now when i am using the code to drawline which was perfectly drawing lines in version 7 seems to have some problem in version 8.

I am using following code

Code: Select all

	CPen1 penMass1 = m_canvas[nChartIndx].GetPen();
	penMass1.SetColor(PEN_COLOR_RED);
	penMass1.SetStyle(psSolid);

	Y0 = m_graph[nChartIndx].GetAxis().GetTop().GetPosition();
	Y1 = m_graph[nChartIndx].GetAxis().GetBottom().GetPosition();
	m_canvas[nChartIndx].DrawLine(X0, Y0, X1, Y1);

	// drawing line intersecting Y axis
	penMass1.SetColor(PEN_COLOR_BLACK);
	penMass1.SetStyle(psDash);

	long YMid = (Y1 + Y0) / 2;
	X0 = m_axisLeft[nChartIndx].GetPosition();
	X1 = m_axisRight[nChartIndx].GetPosition();
	X1 = m_graph[nChartIndx].GetAxis().GetRight().GetIStartPos();
	m_canvas[nChartIndx].DrawLine(X0, YMid, X1, YMid);
To draw an vertical and horizontal line but

it is not drawing the horizontal line properly,. Would you please help me??


Thanks in advance.

Re: DrawLine problem

Posted: Mon Oct 25, 2010 11:36 am
by narcis
Hi roger,

I'm afraid some code is missing here to be able to reproduce the problem. Anyway, code snippet below works fine for us here. Does it works fine at your end? Can you please attach a simple example project we can run "as-is" to reproduce the problem here?

Code: Select all

void CV8ExampleDlg::OnOnAfterDrawTchart1() 
{
	int X0 = m_Chart1.GetAxis().GetBottom().GetIStartPos();
	int X1 = m_Chart1.GetAxis().GetBottom().GetIEndPos();
	int Y0 = X0 + ((X1 - X0) / 2);
	int Y1 = Y0;
	
	m_Chart1.GetCanvas().GetPen().SetColor(RGB(255,0,0));
	m_Chart1.GetCanvas().DrawLine(X0, Y0, X1, Y1);

	Y0 = m_Chart1.GetAxis().GetLeft().GetIStartPos();
	Y1 = m_Chart1.GetAxis().GetLeft().GetIEndPos();
	X0 = Y0 + ((Y1 - Y0) / 2);
	X1 = X0;

	m_Chart1.GetCanvas().DrawLine(X0, Y0, X1, Y1);
}
Thanks in advance.