12-18-2014 09:41 AM - edited 12-18-2014 09:44 AM
My problem is I have created a new custom custom using the NI wpf graph as the basis. The control consist mainly of the graph,its axes and legends on a grid. To allow the legend to be moved around, I put it in a child grid. My problem is while trying to export the control as an image I am using the code below (similar to wpf graph export to image😞
Rect bounds = LayoutInformation.GetLayoutSlot(MainGrid); var bitmap = new RenderTargetBitmap((int)bounds.Width + 1, (int)bounds.Height + 1, 96, 96, PixelFormats.Default); bitmap.Render(MainGrid);
My problem is the axes and the edges of the image exported to clipboard is dark as shown below. Is saved to image, the edges are instead transparent but better (not visible in the photos app but visible in paint). My question is why is this behavior and how can it be avoided?
Thanks.
Solved! Go to Solution.
12-18-2014 09:47 AM
I did a bit of research and it seems the dark color is due to the trasnparency of the axes and edges of the image: the clipboard in windows does not support transparent image. The question is how can this transparency be removed from the axes and edges of the image?
Thanks.
12-18-2014 10:21 AM - edited 12-18-2014 10:37 AM
The problem is the default color of grid or niGraph in WPF is transparent. I simply changed either color and the image now saved properly.