A
andrew
I have a MSchart object (COM Component) which I wish to
insert as an image into a picture box so that I can print
it out.
'I call the chart controls's EditCopy to pass data to the
clipboard.
Dim Img As Image
MyChart.EditCopy()
'I then declare an IDataObject
Dim data As IData = Clipboard.GetDataObject()
'I THen check to see whether emf data is present
If (data.GetDataPresent(DataFormats.EnhancedMetafile)) Then
'(Checking this statement in at debug evaluates to true)(I
also am satisfied that the data is on the clipboard
because I am able to Paste Special it into EXCEL)
'I then try and recreate the emf as an image and have
tried the following combinations
'Img.FromFile(data.GetData(DataFormats.EnhancedMetafile))
'Img = CType(data.GetData(DataFormats.EnhancedMetafile)),
Image)
UNFORTUNATELY THE ABOVE CODE SEEMS TO RETURN NOTHING FOR
THE Img VARIABLE, AND INDICATES TO ME THAT I HAVE TO
SOMEHOW INSTATIATE AND CONSTRUCT THE Img FROM THE METAFILE
DATA, HOWEVER I HAVE NO IDEA HOW TO DO THIS.
'I then hope to assign my Image to the PictureBox Control
PictureBox1.Image= Img
End If
I PRESUME IT IS POSSIBLE TO COPY IMAGES OF COM OBJECTS TO
WIN FORM PICTURE BOXES (WITHOUT RESORTING TO PHOTOCOPYING
AND SCANNING!), CAN ANYONE GIVE ME SOME POINTERS PLEASE.
THANKS IN ADVANCE
ANDREW
insert as an image into a picture box so that I can print
it out.
'I call the chart controls's EditCopy to pass data to the
clipboard.
Dim Img As Image
MyChart.EditCopy()
'I then declare an IDataObject
Dim data As IData = Clipboard.GetDataObject()
'I THen check to see whether emf data is present
If (data.GetDataPresent(DataFormats.EnhancedMetafile)) Then
'(Checking this statement in at debug evaluates to true)(I
also am satisfied that the data is on the clipboard
because I am able to Paste Special it into EXCEL)
'I then try and recreate the emf as an image and have
tried the following combinations
'Img.FromFile(data.GetData(DataFormats.EnhancedMetafile))
'Img = CType(data.GetData(DataFormats.EnhancedMetafile)),
Image)
UNFORTUNATELY THE ABOVE CODE SEEMS TO RETURN NOTHING FOR
THE Img VARIABLE, AND INDICATES TO ME THAT I HAVE TO
SOMEHOW INSTATIATE AND CONSTRUCT THE Img FROM THE METAFILE
DATA, HOWEVER I HAVE NO IDEA HOW TO DO THIS.
'I then hope to assign my Image to the PictureBox Control
PictureBox1.Image= Img
End If
I PRESUME IT IS POSSIBLE TO COPY IMAGES OF COM OBJECTS TO
WIN FORM PICTURE BOXES (WITHOUT RESORTING TO PHOTOCOPYING
AND SCANNING!), CAN ANYONE GIVE ME SOME POINTERS PLEASE.
THANKS IN ADVANCE
ANDREW