Insert image through code

[ Edited ]

Guys --


I am trying to insert a bitmap image(*.bmp) into draft, through program (tried in ST3 MP2, it's base release and in ST2).

I found two ways of inserting the image.


1)SmartFrame2d.CreateEmbed(@"C:\untitled.bmp", Missing.Value);

2)Symbols.Add(OLEInsertionTypeConstant.igOLEEmbedded, @"C:\untitled.bmp", dX, dY, Missing.Value);


But both methods inserts a very blurred image in ST3 but works fine in ST2.


Inserting image type JPEG(*.jpg), results in throwing out error and for TIF type,

outline boundary of the image appears without image and no error.



Please let me know, how to insert the image properly in ST3.


Just in case anybody want to know how it is working:-



 * I am unable to insert any other image type other than *.bmp through program in either ST2 or ST3.

 * Inserting *.bmp works fine in ST2, but not in ST3




using System;

using System.Collections.Generic;

using System.Text;

using System.Reflection;

using SolidEdgeConstants;

using System.Windows.Forms;


namespace ClassLibrary2


    class InsertImage



        /// Adds an image file into the active sheet in draft


        /// Draft document

        /// X-location of the image file in Sheet

        /// Y-location of the image file in Sheet

        public void AddImageInDraft(ref SolidEdgeDraft.DraftDocument draft, double dX, double dY)




                SolidEdgeFramework.Symbols pSymbols = null;

                SolidEdgeFramework.Symbol2d SEdgeSymb2D = null;

                SolidEdgeDraft.Sheet pSheet = null;

                SolidEdgeFrameworkSupport.SmartFrames2d smartFrames = null;

                SolidEdgeFrameworkSupport.SmartFrame2d smartFrame = null;

                SolidEdgeFrameworkSupport.SmartFrame2dStyles smart2DStyles = null;

                smart2DStyles = (SolidEdgeFrameworkSupport.SmartFrame2dStyles)draft.SmartFrame2dStyles;


                pSheet = draft.ActiveSheet;


                //First Method using SmartFrames2D


                smartFrames = (SolidEdgeFrameworkSupport.SmartFrames2d)pSheet.SmartFrames2d;

                smartFrame = (SolidEdgeFrameworkSupport.SmartFrame2d)smartFrames.AddBy2Points(smart2DStyles.Item(1).Name, 0, 0, 0.1, 0.1);

                smartFrame.SetOrigin(dX, dY);

                smartFrame.BorderVisible = true;

                smartFrame.CreateEmbed(@"C:\untitled.bmp", Missing.Value);

                smartFrame.SetOrigin(dX, dY);



                //Second method using Symbols


                pSymbols = (SolidEdgeFramework.Symbols)pSheet.Symbols;

                SEdgeSymb2D = (SolidEdgeFramework.Symbol2d)pSymbols.Add

                              ((int)enumInsertionType, @"DETAIL B.tif", dX, dY, Missing.Value);

                SEdgeSymb2D = (SolidEdgeFramework.Symbol2d)pSymbols.Add

                              ((int)OLEInsertionTypeConstant.igOLEEmbedded, @"DETAIL B.tif", dX, dY, Missing.Value);





            catch (Exception ex)










Posted by: Kiran Thomas
Post date: 2/16/2011 2:38:11 AM