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!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.