Fix for bug #3600171, using a default VRefresh if the returned value is 0 or 1.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2422 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-01-10 07:25:44 +00:00
commit 97a853d450

View file

@ -29,6 +29,7 @@ namespace GreenshotPlugin.Controls {
/// Extend this Form to have the possibility for animations on your form
/// </summary>
public class AnimatingForm : GreenshotForm {
private const int DEFAULT_VREFRESH = 60;
private int vRefresh = 0;
private Timer timer = null;
@ -51,6 +52,11 @@ namespace GreenshotPlugin.Controls {
vRefresh = GDI32.GetDeviceCaps(hDCDesktop, DeviceCaps.VREFRESH);
User32.ReleaseDC(hDCDesktop);
}
// A vertical refresh rate value of 0 or 1 represents the display hardware's default refresh rate.
// As there is currently no know way to get the default, we guess it.
if (vRefresh <= 1) {
vRefresh = DEFAULT_VREFRESH;
}
return vRefresh;
}
}