PsyVision Posted July 21, 2008 Report Share Posted July 21, 2008 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 Quote Link to comment Share on other sites More sharing options...
Frank Posted July 21, 2008 Report Share Posted July 21, 2008 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; Quote Link to comment Share on other sites More sharing options...
PsyVision Posted July 22, 2008 Author Report Share Posted July 22, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.