You can adjust the working area of the screen using the SystemParametersInfo WinAPI call. This requires a bit of P/Invoke. The following code should get you started in that direction. It's a short example that changes the working bounds of the desktop area by reducing it from the top 40 pixels. It then waits for user input, and re-adjusts the area back to it's original position. This is a console application.
using System.Runtime.InteropServices;
using System;
namespace ConsoleApplication1
{
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
class WorkArea
{
[DllImport("user32.dll", EntryPoint="SystemParametersInfoA")]
public static extern bool SystemParametersInfo(uint uAction, uint uparam, ref RECT rect, uint fuWinIni);
private const uint WM_SETTINGCHANGE = 0x1a;
const uint SPI_GETWORKAREA = 48;
const uint SPI_SETWORKAREA = 47;
public static bool SetWorkArea(RECT rect)
{
return SystemParametersInfo(SPI_SETWORKAREA, 0, ref rect, WM_SETTINGCHANGE);
}
public static RECT GetWorkArea()
{
RECT rect = new RECT();
SystemParametersInfo(SPI_GETWORKAREA, 0, ref rect, 0);
return rect;
}
}
class Program
{
static void Main(string[] args)
{
RECT original = WorkArea.GetWorkArea();
// create the new boundaries. Start with the original
RECT newBounds = original;
newBounds.Top += 40;
// set the new boundaries.
WorkArea.SetWorkArea(newBounds);
// wait for user input.
Console.WriteLine("Bounds have changed. Try minimizing and maximizing a window," +
"then press enter to restore the window to it's original state.");
Console.ReadLine();
// reset the original boundaries.
WorkArea.SetWorkArea(original);
// wait for user input.
Console.WriteLine("All done.");
Console.ReadLine();
}
}
}
David Morton -
http://blog.davemorton.net/