This property allows a raster image or a vector image to be passed between the ImageKit and a VisualBasic Picture object or a C#.NET/VB.NET Image object.
Reference
This value refers to the VisualBasic Picture object or the C#.NET/VB.NET Image object.
Explanation
It's possible to pass either a raster image or a vector image from the ImageKit to the VisualBasic Picture object. However, with the C#.NET/VB.NET Image object, although you can pass a vector image from the ImageKit Control, the vector image is converted to a raster image in the C#.NET/VB.NET Image object.
In Visual Basic:
(1) To pass an image from a PictureBox to the ImageKit:
ImageKit1.Layer(0).Picture = Picture1.Picture
(2) To pass an image from the ImageKit to a PictureBox
Picture1.Picture = ImageKit1.Layer(0).Picture
In VB.NET/ C#.Net:
It is not possible to pass an image directly from the PictureBox's Image property. Instead you will need to derive a class from the AxHost class (in the System.Windows.Forms namespace) and execute the GetIPictureDispFromPicture (or GetIPictureFromPicture) method and the GetPictureFromIPicture method. In the following example, the class name is IPictureDispHost, the method names are GetIPictureDisp (this executes the AxHost class's GetIPictureDispFromPicture method) and the GetPicture (this executes the AxHost class's GetPictureFromIPicture method).
(1) To pass an image from a PictureBox to the ImageKit:
In VB.NET
ImageKit1.get_Layer(0).Picture =
DirectCast(IPictureDispHost.GetIPictureDisp(PictureBox1.Image),
stdole.IPicyureDisp)
In C#.NET
ImageKit1.get_Layer(0).Picture =
(stdole.IPictureDisp)IPictureDispHost.GetIPictureDisp(PictureBox1.Image);
(2) To pass an image from the ImageKit to a PictureBox
In VB.NET
PictureBox1.Image =
IPictureDisp.GetPicture(ImageKit1.get_Layer(0).Picture)
In C#.NET
PictureBox1.Image =
IPictureDisp.GetPicture(ImageKit1.get_Layer(0).Picture);
Note: At runtime, prior to setting the Picture(Image) object to the Picture property, it is necessary to free any previous contents of the Picture property from the memory.
In Visual Basic:
Set Picture1.Picture = LoadPicture(path)
ImageKit1.Layer(0).Picture = LoadPicture()
ImageKit1.Layer(0).Picture = Picture1.Picture
In VB.NET:
PictureBox1.Image = Image.FromFile(path)
ImageKit1.get_Layer(0).Picture = Nothing
ImageKit1.get_Layer(0).Picture = DirectCast(IPictureDispHost.GetIPictureDisp(PictureBox1.Image), stdole.IPictureDisp)
In C#.NET:
PictureBox1.Image = Image.FromFile(path);
ImageKit1.get_Layer(0).Picture = null;
ImageKit1.get_Layer(0).Picture = (stdole.IPictureDisp)IPictureDispHost.GetIPictureDisp(PictureBox1.Image);
Setting this value
This value can be set at design-time and run-time.Retrieving this value
This value can be retrieved at run-time.