Jump to content
Software FX Community

Paint Event Problem


PsyVision

Recommended Posts

Posted

Hello,

I am working on a project where I wish to be able to click once on the graph, store the X,Y co-ordinates and then draw a line from that point to wherever the mouse moves to (within the bounds of the graph).

I know how to go about doing this, but I would like to use the Paint event to draw the line using GDI+, however, I cannot access the Paint event because ChartFX has a method for painting the graph to a Graphics structure that hides the Paint event and so Visual Studio reports an error.

I have tried to use the PostPaint event but it does not fire often enough.

Any ideas?

Thanks

Posted

Use the PrePaint and PostPaint events instead.

> I have tried to use the PostPaint event but it does not fire often enough.

What do you mean by "often enough"? By default the chart caches the chart image until a property is changed, if you are painting differently even as chart properties remain the same, you need to disable image caching by doing:

chart.ExtraStyle = ~ChartStyles.CacheImage;

 

Posted

Thank you for your reply. I will look into what you have detailed here.

By  often enough I meant that the chart is only redrawn at certain times (highlighting of points/lines etc) whereas I wanted a paint event that fired much like other controls.  I did not know that the chart was cached.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...