public HoverInteraction(DataChartGui <T> chart) { this.Chart = chart; Lines = new LineDrawer(); //this.Chart.stockPricePlot.Add(Lines); //Lines.Canvas.Size = Chart.stockPricePlot.Canvas.Size; Lines.Canvas.Image = new System.Drawing.Bitmap(Chart.Plot.Canvas.Size.Width, Chart.Plot.Canvas.Size.Height); Lines.Canvas.BackColor = System.Drawing.Color.Transparent; Lines.Canvas.Size = Chart.Plot.Canvas.Size; Lines.Canvas.Enabled = false; Chart.Plot.Canvas.Controls.Add(Lines.Canvas); Chart.Plot.Canvas.Resize += (object sender, System.EventArgs e) => { int width = Chart.Plot.Canvas.Size.Width; int height = Chart.Plot.Canvas.Size.Height; Lines.Canvas.Image = new System.Drawing.Bitmap(width, height); Lines.Canvas.Size = Chart.Plot.Canvas.Size; }; }
public LineInteraction(DataChartGui chart) { this.Chart = chart; Canvas.Image = new System.Drawing.Bitmap(Chart.Plot.Canvas.Size.Width, Chart.Plot.Canvas.Size.Height); Canvas.BackColor = System.Drawing.Color.Transparent; Canvas.Size = Chart.Plot.Canvas.Size; Canvas.Enabled = false; Chart.Plot.Canvas.Controls.Add(Canvas); Chart.Plot.Canvas.Resize += (object sender, System.EventArgs e) => { int width = Chart.Plot.Canvas.Size.Width; int height = Chart.Plot.Canvas.Size.Height; if ((width > 0) && (height > 0)) { Canvas.Image = new System.Drawing.Bitmap(width, height); Canvas.Size = Chart.Plot.Canvas.Size; } }; }