GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / GifSetLoopCount Method
GdPicture image identifier. The multiframe gif image. (Can be an editable multiframe gif or a read-only gif image.).
The number of times the animation should be played. Between 0 and 65536. 0 = infinite.
Example





In This Topic
GifSetLoopCount Method (GdPictureImaging)
In This Topic
Sets the "Loop Count" of a multiframe gif image. A Loop Count is the number of times an animation of the multiframe gif should be played.
Syntax
'Declaration
 
Public Function GifSetLoopCount( _
   ByVal ImageID As Integer, _
   ByVal LoopCount As Integer _
) As GdPictureStatus
public GdPictureStatus GifSetLoopCount( 
   int ImageID,
   int LoopCount
)
public function GifSetLoopCount( 
    ImageID: Integer;
    LoopCount: Integer
): GdPictureStatus; 
public function GifSetLoopCount( 
   ImageID : int,
   LoopCount : int
) : GdPictureStatus;
public: GdPictureStatus GifSetLoopCount( 
   int ImageID,
   int LoopCount
) 
public:
GdPictureStatus GifSetLoopCount( 
   int ImageID,
   int LoopCount
) 

Parameters

ImageID
GdPicture image identifier. The multiframe gif image. (Can be an editable multiframe gif or a read-only gif image.).
LoopCount
The number of times the animation should be played. Between 0 and 65536. 0 = infinite.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method works with both editable multiframe gif images and ones opened as read-only.

This method requires the Image Documents component to run.

Example
Creating a multiframe Gif image based on image files.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Create a new editable multiframe Gif image based on an image file and append frames from files.
    int imageID = gdpictureImaging.GifCreateMultiFrameFromFile("frame1.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame2.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame3.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame4.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame5.bmp");
 
    // Set the number of times the animation should be played, 0 = infinite.
    gdpictureImaging.GifSetLoopCount(imageID, 0);
 
    // Set the "frame time" for each and every frame to 1s and the frame disposal to leave the image in place to beentirely or partially overdrawn by the next image.
    int frameCount = gdpictureImaging.GifGetFrameCount(imageID);
    for (int frameNo = 1; frameNo <= frameCount; frameNo++)
    {
        gdpictureImaging.GifSetFrameTime(imageID, frameNo, 100);
        gdpictureImaging.GifSetFrameDisposal(imageID, frameNo, 1);
    }
 
    gdpictureImaging.GifSaveMultiFrameToFile(imageID, "image.gif");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also