ive got a full screen loading page after my software's done running,which includes a preloader gif file .... which is exactly like the one windows 8 is using for store and metro.
however the problem is that no matter what the fps and speed of the gif file is,the C# windows form will show the same lower fps.
i really dont know what to do with it as i've tried to search the internet to find a solution but whatever i ran into was either unclear or unrelated.
i suspect that somehow the compiler is ignoring the fps integrated within the gif file i imported. but i do not know how i can set the fps to what it is for the file,or make the IDE/Compiler ignore its rules when it comes to that file..please advise <3
here is the link to the file properties im using http://preloaders.net/en/search/windows%208 the one in the middle from the top row...it has 75 frames and the rest is as it is...
im currently using a picturebox control to include the gif in my project (its within a winform project)
This is a normal mishap, GIFs specify the display time for a frame in units of 10 milliseconds. But timers on Windows, by default, are not sufficiently accurate to time intervals that low. Timers are updated by the system clock interrupt, it ticks 64 times per second by default. Giving timers an accuracy no better than 15.625 milliseconds. In effect, your GIF will playback at 2/3rd speed, give or take.
You can change the outcome by starting another program, like Windows Media Player or a browser like Firefox or Chrome. And you'll suddenly see your GIF playing back at design speed.
You'll have to do the same thing these programs do, alter the clock interrupt rate to get consistent playback speeds. You need to pinvoke timeBeginPeriod, pass 10 to improve the timer accuracy to 10 milliseconds. You may need to go lower if your UI thread isn't responsive and starts the timer too late. Be sure to pinvoke timeEndPeriod() again when you no longer need the playback, typically in the FormClosed event handler.
Boilerplate code:
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
timeBeginPeriod(timerAccuracy);
}
protected override void OnFormClosed(FormClosedEventArgs e) {
timeEndPeriod(timerAccuracy);
base.OnFormClosed(e);
}
// Pinvoke:
private const int timerAccuracy = 10;
[System.Runtime.InteropServices.DllImport("winmm.dll")]
private static extern int timeBeginPeriod(int msec);
[System.Runtime.InteropServices.DllImport("winmm.dll")]
public static extern int timeEndPeriod(int msec);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With