Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. how to disable windows form hide animation?

how to disable windows form hide animation?

Scheduled Pinned Locked Moved Windows Forms
csharpvisual-studiohelptutorialquestion
3 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neodeaths
    wrote on last edited by
    #1

    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.

    L X 2 Replies Last reply
    0
    • N neodeaths

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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[^]

      1 Reply Last reply
      0
      • N neodeaths

        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.

        X Offline
        X Offline
        xstoneheartx
        wrote on last edited by
        #3

        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);
        }
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups