Hi all,
I'm trying to convert a ScatterGraph control into a bitmap or jpg file so that the image can be saved. After some searching, I can't seem to track down the nature of the problem I'm having. Any help would be appreciated.
The current code that I have is this:
Dim image As Bitmap = New Bitmap(ScatterGraph1.Width, ScatterGraph1.Height)
Dim target_bounds As Rectangle
target_bounds.Width = ScatterGraph1.Width
target_bounds.Height = ScatterGraph1.Height
target_bounds.X = 0
target_bounds.Y = 0
ScatterGraph1.DrawToBitmap(image, target_bounds)
image.Save("test.jpg", Drawing.Imaging.ImageFormat.Jpeg)
This code works to some extent. If I call this code before any data is graphed, then the file is saved with a blank graph, which makes sense. But once I add data to the ScatterGraph, the code doesn't seem to do anything. No file is saved and no error or exception is thrown. I've tried doing things in different orders and I can't seem to track down why the image will save the graph with no data, but it won't save the graph with data.
I'm sure this is probalby something simple, but please let me know if you have any suggestions.
Thanks,
Dave