2

I have an application that minimizes to the system tray. That all works well, the problem is that when minimized the animation goes towards the left side of the screen.

Is there a way to change it so the animation goes towards the tray?

NMunro
  • 1,282
  • 4
  • 18
  • 33
  • http://stackoverflow.com/questions/4998833/win32-c-api-for-redirecting-minimize-animation – paul May 29 '13 at 14:48
  • @paul That's Win32/C, this is C#/WinForms. – qJake May 29 '13 at 14:49
  • @SpikeX You can call Win32 API functions from c# – paul May 29 '13 at 14:50
  • @paul I know, but a better thing to do would be to post the P/Invoke code required to make that work in an answer instead of just linking to the other answer with no explanation. ;) – qJake May 29 '13 at 14:54
  • @SpikeX Really? I don't like copy pasting existing valid answers to questions, especially if I am only making a comment about a similar question already existing. – paul May 29 '13 at 14:56
  • I wasn't suggesting you copy/paste, I said *post the P/Invoke code required to make that solution work*, which doesn't exist in the other question. You would need to write it yourself. – qJake May 29 '13 at 15:00

1 Answers1

2

No. This animation is handled by Windows, and since you are invoking the Minimize routine on the window, Windows will automatically animate the window into the location where the window's button is on the taskbar. If you're looking for a "quick solution", there isn't one.

The most you could do is change the window's behavior so that when it's minimized, it actually closes instead. This would prevent the fly-down animation into the taskbar, and Windows would perform the window close animation instead, which may look more consistent with your application design. A lot of other tray icon programs handle it this way.

If you really want to change the window's animation, you will need to override any Windows window management features with your own, that way when the window is "minimized" (or closed), you can animate your window to appear to move into the notification area on the right.

qJake
  • 16,821
  • 17
  • 83
  • 135
  • "The most you could do is change the window's behavior so that when it's minimized, it actually closes instead." When you say that it closes, do you mean it kills the process, or just executes the close animation? – NMunro May 29 '13 at 14:50
  • No, it simply closes the window, the process would remain active (including the tray icon). In order to actually terminate the process, you would need to call something like `Environment.Exit(0);` or `Application.Exit();` – qJake May 29 '13 at 14:52