How can I show the two charts from two forms in another form like overview?

I would do something this: 1) Create 2 user controls containing a mschart, and call them e.g. PieChartControl and BarChartControl. Expose a a method to set the current datasource (e.g. SetDataSource(DataTable dt) ) and put there the logic to bind the datasource to the PieChart or the BarChart 2) Create the 3 forms: in Form1 add PieChartControl, in Form2 add BarChartControl and in Form3 add a SplitContainer where you will add both a PieChartControl and a BarChartControl. 3) Expose SetDataSource() method also in Form1 and Form2 (it will just call the corresponding inner control method) 4) Expose also SetDataSource() method in Form3; it will call both SetDataSource() methods of inner PieChartControl and BarChartControl.

5) Form3 has to expose also a custom property (e.g. ChartClicked ) indicating the chart that has been clicked 6) In Form3 subscribe the Click event (or DoubleClick, as you wish) for PieChartControl and BarChartControl 7) When Click event is triggered, just set the ChartClicked property and close the form It will follow some code samples to help you understand my explanation. Helper enum: public enum ChartClicked { None = 0, Pie = 1, Bar = 2 } MainForm: // this is the form that have the button to open Form3 public partial class MainForm: Form { // other methods ... private void openForm3ButtonClick(object sender,Eventargs e) { Form3 f3 = new Form3(); f3. SetDataSource(this.

DataSrc) f3.ShowDialog(); if(f3. ChartClicked == ChartClicked . Pie) { Form1 f1 = new Form1(); f1.

SetDataSource(this. DataSrc); f1.ShowDialog(); } else if(f3. ChartClicked == ChartClicked .

Bar) { Form2 f2 = new Form2(); f2. SetDataSource(this. DataSrc); f2.ShowDialog(); } } } Form3: // the form having the 2 controls public partial class Form3: Form { // other methods ... public ChartClicked ChartClicked { get; private set; } public Form3() { this.

InitializeComponents(); this.PieChartControl. Click += chartControlClicked; this.BarChartControl. Click += chartControlClicked; } public void SetDataSource(object src) { this.PieChartControl.

SetDataSource(src); this.BarChartControl. SetDataSource(src); } private void chartControlClicked(object sender, EventArgs e) { if(sender == this. PieChartControl) this.

ChartClicked = ChartClicked . Pie; else if(sender == this. BarChartControl) this.

ChartClicked = ChartClicked . Bar; this.Close(); } } Form1: // the form having the pie chart control public partial class Form1: Form { // other methods ... public void SetDataSource(object src) { this.PieChartControl. SetDataSource(src); } } Form2: // the form having the bar chart control public partial class Form2: Form { // other methods ... public void SetDataSource(object src) { this.BarChartControl.

SetDataSource(src); } } PieChartControl: public partial PieChartControl: UserControl { // other methods ... public void SetDataSource(object src) { // set the series type to Pie etc... this.chart. DataSource = src; } }.

I can think of a couple of ways to do it. 1) Have your charts connect to a data source for their data. Chart in form 1 and chart 1 in form 3 connect to data source 1.

Chart in form 2 and chart 2 in form 3 connect to the other data source. The charts will show the same data, so their appearance will be the same. This would be like many of the standard controls.

However, if the user can interact with your charts you would need to block that interaction (have a read only property) for the charts in form 3 and duplicate all the events from the charts in forms 1 and 2 to the charts in form 3. 2) Add a method to your forms 1 and 2 (or charts 1 and 2) to get their current display as an Image. Form 3 contains 2 PictureBox controls which show those images.

If there is any interaction you can periodically get the image on a timer event. Your chart control will probably have a cached copy of the image anyway that can be retrieved quickly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions