Scale Image Size of PictureContentControl RRS feed

  • Question


    Hey everyone,

    does anybody know how to resize/scale the image within a picture content control? 

        var logoContentControl = doc.Controls.AddPictureContentControl(logoCell.Range, "_logo" + Guid.NewGuid().ToString());
                    logoContentControl.ShowInsertPictureIcon = false;
                    logoContentControl.Tag = "_logo";
                    var bitmap2 = new System.Drawing.Bitmap(logoFilePath, true);
                    logoContentControl.Image = (bitmap2);
                    logoContentControl.Range.ShapeRange.ScaleWidth((float)0.1, MsoTriState.msoFalse,MsoScaleFrom.msoScaleFromMiddle);

    logoContentControl.Range.ShapeRange.ScaleWidth does not have any effect?



    Monday, January 16, 2012 6:34 PM


  • Hi Tom

    In my experience, the graphic inside a content control won't be a member of the Shapes or ShapeRange listing. It's a member of InlineShapes, so more like:
      logoContentControl.Range.InlineShapes[1].ScaleWidth((float)0.1, MsoTriState.msoFalse,MsoScaleFrom.msoScaleFromMiddle);

    Cindy Meister, VSTO/Word MVP
    • Marked as answer by White Leave Tuesday, January 17, 2012 10:18 PM
    Tuesday, January 17, 2012 4:31 PM