Clipboards, mschart's and pictureboxes

wildfire1982

Regular
Joined
Oct 23, 2003
Messages
50
Location
Southampton
hello,

Im tryin to save a mschart object to a picture. I decided to copy the chart to the clipboard and then from the clipboard to a picturebox where i would save the picture as an image file. What i have tried is below. I found someone elses example which didnt work at all but i had a rehash so the code which is below has been mashed around a bit. Does anyone know where im going wrong? i just cant see it. Cheers for any pointers.

Visual Basic:
        Dim cmdlg1 As New SaveFileDialog
        Dim filename As String
        cmdlg1.ShowDialog()
        filename = cmdlg1.FileName
        AxMSChart1.EditCopy()
        Dim piccy As New PictureBox
        piccy.Image = Clipboard.GetDataObject.GetData(DataFormats.EnhancedMetafile)
        Dim something As New Drawing.Imaging.ImageFormat(Guid.NewGuid)
        something = Imaging.ImageFormat.Emf
       
        Application.DoEvents()
        Dim Images As Image
        Images = piccy.Image
        Images.Save(filename)

Cheers folks

Chris
 
Back
Top