Page 1 of 1

how to add a datagrid control on the teechart

Posted: Tue Dec 20, 2005 5:33 am
by 8127701
Development environment: C#, TeeChart Pro for Visual Studio .NET v1

Problem description: Many information must be displayed in the title of teechart. So we want to put a datagrid control on the teechart to show all the information friendly. When printing, the datagrid must be printed together with the teechart.

Question:Is there any solution to implement this feature?
Add a datagrid control on the teechart or other solution is acceptable.

Posted: Thu Dec 22, 2005 12:31 pm
by narcis
Hi am,

This feature is not available in TeeChart for .NET v1. However, it's available in TeeChart for .NET v2 using a standard System.Windows.Forms.DataGrid and this code:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			bar1.FillSampleValues();

			dataGrid1.DataBindings.Clear();		
			dataGrid1.SetDataBinding(bar1.DataSource, "TeeDataTable");
		}

		private void dragPoint1_Drag(Steema.TeeChart.Tools.DragPoint sender, int index)
		{
			bar1.WriteToDataSource();
			dataGrid1.SetDataBinding(bar1.DataSource, "TeeDataTable");
			dataGrid1.Update();
		}

		private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
		{
			bar1.CheckDataSource();
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			tChart1.Printer.Print();
		}
To print the DataGrid you may use any of the solutions below:


http://xmlfox.com/print_datagrid_net.htm
http://www.c-sharpcorner.com/Graphics/D ... nterMG.asp
http://www.knowdotnet.com/articles/printgriddemo.html