| Top Previous Next |
|
The AddImageAsResource method adds a graphic item (by handle) to a list of Image resources.
Syntax
Parameters
ImageHandle The handle of the image.
ImageType The type of the image.
Return Value
Index of the image in the resource. This index can be used as a parameter to draw the same graphic at different locations using DrawImageRI method.
Remarks
The AddImageAsResource method adds an image as a resource to the engine. All engines maintain a list of reusable resources. Once an image is added to the engine as a resource, it can be used any number of times in the document. This will allow the engine to write the image information in an optimized way so that file size is kept to minimum. Following are the values of TxgtImageType:
Note
Only image types like Bitmap, Icon and Metafile can be inserted using this function. To insert JPEG images, you have to use AddImageMemAsResource function.
Example Code
[VC++] m_Engine.SetFileName("Sample"); m_Engine.BeginDoc();
// Image width and height. double imgWidth = m_Image.GetPicture().GetWidth(); double imgHeight = m_Image.GetPicture().GetHeight();
// Add image to resources list. long Index = m_Engine.AddImageAsResource(m_Image.GetPicture().GetHandle(), itBMP);
// Re-use the image to draw at various positions. m_Engine.DrawImageRI(2, 2, 2 + imgWidth, 2 + imgHeight, Index); m_Engine.DrawImageRI(2, 4, 2 + imgWidth, 4 + imgHeight, Index); m_Engine.DrawImageRI(2, 6, 2 + imgWidth, 6 + imgHeight, Index);
m_Engine.EndDoc();
[VB] With gtEngineX1 .FileName = "Sample" .BeginDoc
'Image width and height Dim ImgWidth, ImgHeight As Double ImgWidth = Image1.Picture.Width ImgHeight = Image1.Picture.Height
'Add image to resources list. Dim Index As Long Index = .AddImageAsResource(Image1.Picture.Handle, itBMP)
'Re-use the image to draw at various positions. .DrawImageRI 2, 2, 2 + ImgWidth, 2 + ImgHeight, Index .DrawImageRI 2, 4, 2 + ImgWidth, 4 + ImgHeight, Index .DrawImageRI 2, 6, 2 + ImgWidth, 6 + ImgHeight, Index
.EndDoc End With
[C#]
axgtEngineX1.FileName = "Sample"; axgtEngineX1.BeginDoc(); //Image width and height long ImgWidth, ImgHeight; ImgWidth = pictureBox1.Image.Width ; ImgHeight = pictureBox1.Image.Height; //Add image to resources list. long Index; Index = axgtEngineX1.AddImageAsResource(Image1.Picture.Handle, itBMP); //Re-use the image to draw at various positions. axgtEngineX1.DrawImageRI( 2, 2, 2 + ImgWidth, 2 + ImgHeight, Index ); axgtEngineX1.DrawImageRI( 2, 4, 2 + ImgWidth, 4 + ImgHeight, Index ); axgtEngineX1.DrawImageRI( 2, 6, 2 + ImgWidth, 6 + ImgHeight, Index ); axgtEngineX1.EndDoc();
See Also
AddImageMemAsResource, DrawImageRI
|