Jump to content
Software FX Community

Paint Event Problem


PsyVision

Recommended Posts

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

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...