Sunday, November 23, 2008

Full screen forms in .NET

Today I tried to make a form take up the whole screen (including the taskbar) in C# on the .NET platform. .NET WinForms does not offer functionality to do this, so I nosed around the web. All results that I found used platform-dependent P/Invoke calls to accomplish this goal. However, I wanted to keep my code platform-independent, so I created a pure, managed .NET solution.

First, we need some member variables to remember the window state, so we can come back out of full screen mode:

About Me

Me elsewhere

Taekwindow

Taekwindow is a small and light Windows program that I wrote. It enables you to move windows by Alt-dragging anywhere in their interior, and resizing by Alt-right-dragging, just like in many X window managers.