I am trying to copy a XamDataChart to my clipboard, this is what i am currently using:
Dim OldSize As New Size(Me.ActualWidth, Me.ActualHeight) copyChart.Measure(New Size(Me.ActualWidth, Me.ActualHeight)) copyChart.Arrange(New Rect(0, 0, Me.ActualWidth, Me.ActualHeight)) Dim Tb As New RenderTargetBitmap(CInt(Me.ActualWidth), CInt(Me.ActualHeight), 96, 96, PixelFormats.Pbgra32) copyChart.UpdateLayout() Tb.Render(copyChart) Clipboard.SetImage(Tb)
Dim OldSize As New Size(Me.ActualWidth, Me.ActualHeight) copyChart.Measure(New Size(Me.ActualWidth, Me.ActualHeight)) copyChart.Arrange(New Rect(0, 0, Me.ActualWidth, Me.ActualHeight))
Dim Tb As New RenderTargetBitmap(CInt(Me.ActualWidth), CInt(Me.ActualHeight), 96, 96, PixelFormats.Pbgra32) copyChart.UpdateLayout() Tb.Render(copyChart) Clipboard.SetImage(Tb)
This creates the chart and copies it to the clipboard, but the lines aren't on there, and it's not drawn quite correctly...is there a quick snippet that will copy a chart to clipboard?
Hello,
I have been looking into your description however I am not sure what might be wrong with your implementation. Would you please attach a test sample, so I can continue investigating into your specific scenario.
Thanks in advance. Looking forward to hearing from you.
I'm on travel until tomorrow, so I'll see if i can work something up quickly...
if it helps, i'm actually creating a copy of the chart before attempting the screenshot via a copy constructor that recreates the series, so it's possible that I've got something wrong in that.
Hello all,
I have created a test sample () in C# following sykobag’s approach. along with saving the XamDataChart to file, with the difference that I did this on button clicks to avoid any rendering issues. Sykobag, I suppose that, as you mentioned, there might be something amiss in your project. If you could attach a test sample reproducing your scenario I’d be glad to look into it for you.
Please let me know if I could be of any further assistance.
Hi,
I tried this sample and everything worked except one thing. When I copy to clipboard and then paste into for example paint or word, I get a black border on the top and left sides. This border is not there when you export to a png file.
Is it possible to get rid of this border?
Kind Regards
Fredrik Dahlberg