how to disable windows form hide animation?
-
hi does anyone know how i can disable the animation which happens to a windows form when the this.hide() is used? i am trying to do this without using thread.sleep. i am using vs.net 2012. thanks and any help is appreciated.
neodeaths wrote:
hi does anyone know how i can disable the animation which happens to a windows form when the this.hide() is used?
I haven't tried it, but I guess it'd be the performance options of Windows. There's a setting in the system-page somewhere that let's the user decide between "cool" (animations, shades and stuff) and "fast" (no animation, no shades). Or to let Windows decide. AFAIK, it's a settting that would change the behaviour for ALL applications.
neodeaths wrote:
i am trying to do this without using thread.sleep.
Try clearing the
.Controls
collection and making the form 100% transparent. "Hide" it after that.Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
hi does anyone know how i can disable the animation which happens to a windows form when the this.hide() is used? i am trying to do this without using thread.sleep. i am using vs.net 2012. thanks and any help is appreciated.
Maybe this help:
enum DWMWINDOWATTRIBUTE : uint
{
NCRenderingEnabled = 1,
NCRenderingPolicy,
TransitionsForceDisabled,
AllowNCPaint,
CaptionButtonBounds,
NonClientRtlLayout,
ForceIconicRepresentation,
Flip3DPolicy,
ExtendedFrameBounds,
HasIconicBitmap,
DisallowPeek,
ExceludedFromPeek,
Cloak,
Cloaked,
FreezeRepresentation
}[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attr, ref int attrValue, int attrSize);protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
if (Environment.OSVersion.Version.Major >= 6)
{
int attrValue = 1;
int hr = DwmSetWindowAttribute(this.Handle, DWMWINDOWATTRIBUTE.TransitionsForceDisabled, ref attrValue, 4);
if (hr < 0)
Marshal.ThrowExceptionForHR(hr);
}
}