Unable to get Chart Paint events
I want to do some custom drawing in a chart. To do this I need to access the ChartGraphics Object referenced by the PrePaint and PostPaint Chart events. Are these events working? So far I have tried subscribing to the event at multiple points in the report generation, without success. Here an example:
private void Plot_1BeforePrint(object sender, EventArgs e)
{
Plot_1.Chart.PostPaint += OnPostPaint;
Plot_1.Chart.Invalidate(); // Is supposed to repaint the chart and call PrePaint, Paint, and PostPaint events.
}
private void OnPostPaint(object sender, ChartPaintEventArgs e)
{
Console.WriteLine("I never see this line.");
var cg = e.ChartGraphics; // This is the thing I want!
}
Any help would be greatly appreciated. Thanks!