Bonjour,
Je cherche à mettre des images initialement au format OLE (mes images sont issues d'un collage spécial avec PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteJPG)) dans une pictureBox d'un WinForm.
J'ai pensé à un Shape.Export() puis après réimporter, mais je veux faire ça sur des fichiers avec plusieurs images ca va être très lent à l'exécution (et ca ne me parait pas très propre de devoir enregister une image dans un fichier puis aller lire à nouveau ce fichier...).

Si j'essaie ce code pictureBox.Image = (System.Drawing.Image)shape.OLEFormat.Object; j'ai un message d'erreur :
System.InvalidCastException: 'Unable to cast COM object of type 'System.__ComObject' to class type 'System.Drawing.Image'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.'

Savez vous comment je pourrais faire ?

Merci !