public HoverInteraction(StockChart 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.stockPricePlot.Canvas.Size.Width, Chart.stockPricePlot.Canvas.Size.Height); Lines.Canvas.BackColor = System.Drawing.Color.Transparent; Lines.Canvas.Size = Chart.stockPricePlot.Canvas.Size; Lines.Canvas.Enabled = false; this.Chart.stockPricePlot.Canvas.Controls.Add(Lines.Canvas); }
public HoverInteraction(StockChart 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.stockPricePlot.Canvas.Size.Width, Chart.stockPricePlot.Canvas.Size.Height); Lines.Canvas.BackColor = System.Drawing.Color.Transparent; Lines.Canvas.Size = Chart.stockPricePlot.Canvas.Size; Lines.Canvas.Enabled = false; this.Chart.stockPricePlot.Canvas.Controls.Add(Lines.Canvas); this.Chart.stockPricePlot.Canvas.Resize += (object sender, System.EventArgs e) => { int width = Chart.stockPricePlot.Canvas.Size.Width; int height = Chart.stockPricePlot.Canvas.Size.Height; Lines.Canvas.Image = new System.Drawing.Bitmap(width, height); Lines.Canvas.Size = Chart.stockPricePlot.Canvas.Size; Chart.priceText.Location = new Point(((width / 2) - (Chart.priceText.Width / 2)), Chart.priceText.Location.Y); Chart.changeText.Location = new Point(((width / 2) - (Chart.changeText.Width / 2)), Chart.changeText.Location.Y); }; }