I'm trying to copy an image of a bar chart to clipboard so it can be pasted into another program (i.e. Powerpoint). The chart portion of the image copies ok, but the surrounding area that includes the axes, titles, and labels is solid black. I'm using the
following code to try to grab a screen capture of the chart image.
private static BitmapSource CaptureScreen(Visual target, double dpiX, double dpiY)
if (target == null)
Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
RenderTargetBitmap targetBitmap =
BitmapSource source = BitmapFrame.Create(targetBitmap);
Then I just do a Clipboard.SetImage() on the returned value. I'm assuming there is something obvious that I'm missing as pasting a screen capture isn't
that unusal of a goal. Any help or pointer to some sample code would be appreciated.