The number of frames within your bitmap is 5 - because 707 divided by 118 is 5.99. This means, the bitmap contains five complete frames. Thus, NoOfFrames is 5.
That means, you can select
Image.FrameNumber = 0;
Image.FrameNumber = 1;
Image.FrameNumber = 2;
Image.FrameNumber = 3;
Image.FrameNumber = 4;
In your code, there is the error that you increment the frame number after you check for the valid range:
if(Variable < Application::menu_icons.NoOfFrames)
{
Variable++;
}
else
{
Variable = 0;
}
Image.FrameNumber = Variable;
After changing the code to the following, it works as expected:
Variable++;
if ( Variable >= Application::menu_icons.NoOfFrames )
Variable = 0;
Image.FrameNumber = Variable;
Best regards,
Manfred.