Find out Size (and position) of the taskbar

What size is the taskbar on this computer? And where is it at all? This post has the answer.

A common problem is to find out the size and the location of the taskbar.

Almost as common as the problem is the following solution:

public static int GetTaskbarHeight()
    return Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height;

At least, it is better than hardcoding the height in code. And it will work on lots of machines.

However, it has some really bad disadvantages:

Read the rest of this entry »