0

Possible Duplicate:
How to make a window always stay on top in .Net?
Creating a .NET app that “docks” to the side of the screen and limits other windows' sizes when maximized

I have a C# Winforms application that runs similarly to the menu bar on a Mac. It's only 24 pixels high, is the full width of the screen, located at the top and should be the top most application.

However, when I run other applications and maximize them, they go under my application and I cannot see the control bar (icon, name, minimize, maximize and close buttons) for them. What I would like is for other maximized applications to maximize to just under my application, so I can still see the other applications control bar.

Is there a way to prevent other applications from doing this, and getting them to maximize under my application?

Thanks, Karl

Community
  • 1
  • 1
Karl
  • 912
  • 2
  • 16
  • 28
  • 1
    Try setting `Form.TopMost = true`, but if you're running on Mac with `mono` then it can be very tricky – Alvin Wong Oct 22 '12 at 11:10
  • I've already set form.TopMost = true, but it made no difference. – Karl Oct 22 '12 at 11:12
  • 1
    Read this and understand how it applies to your case: [*What if two programs did this?*](http://blogs.msdn.com/b/oldnewthing/archive/2005/06/07/426294.aspx). – Richard Oct 22 '12 at 11:13
  • Thanks Richard. I understand what the post is saying, but I guess I'm trying to prevent two applications from using the same space, and forcing any other applications to ignore the desktop real estate used by my application. – Karl Oct 22 '12 at 11:18

1 Answers1

1

This is a duplicate of Creating a .NET app that "docks" to the side of the screen and limits other windows' sizes when maximized. Please note that the link to the C# version of the code is dead. Here are the relevant, working links:

http://www.codeproject.com/Articles/6741/AppBar-using-C

http://msdn.microsoft.com/en-us/library/windows/desktop/cc144177(v=vs.85).aspx

Community
  • 1
  • 1
Simon
  • 1,814
  • 20
  • 37
  • If you think a question is a duplicate, leave a comment and flag the question as a duplicate. It's not necessary or desirable to answer it. – ChrisF Oct 22 '12 at 11:19
  • This is exactly what I was after. Thanks. – Karl Oct 22 '12 at 11:42