Image control

Hi,

I use some Image Control in my presentation (created with ms PowerPoint 2003) and I would like to change the Image displayed. But It doesn't work, all properties are well-set (PictureId,for example, has the same value as the PictureID) but I only have a blanck instead of my picture (see file attached). My code is:

Presentation pres = new Presentation("MyPresentation.ppt");

Slide slide = pres.GetSlideByPosition(1);

Bitmap bitmap = new Bitmap("myPicture..JPG");

Picture picture = new Picture(pres,bitmap);

int id = pres.Pictures.Add(picture);

for (int i = 0; i < slide.Shapes.Count; ++i)

{

if (slide.Shapes[i] is PictureFrame)

{

PictureFrame pf = slide.Shapes[i] as PictureFrame;

pf.PictureId = id;

}

}

pres.Write("MyPresentationModified.ppt");

Thank you

Hi,

The above code should replace the existing picture with the new picture. Can you please provide the source ppt for investigation?.