I am creating a function in a core DLL that will compute the size a form object should be based on the screen resolution and required border, taking into consideration any taskbars, docked windows, etc...

I am using the System.Windows.Forms.Screen namespace.

My question is, will this name space only work on single monitor machines? If someone is using the application on a machine with dual monitors will it base the calculations using the resolution of the primary video card, or which ever screen the application is being displayed on.

Its confusing me because its pulling the information from the primary screen. So I'm assuming this function will not work on a machine running dual monitors. Unless all monitors are running the same resolution.

I would just test it, however I don't have access to a second monitor. I have included the code incase someone has a dual monitor machine they can run this on and see what happens.

Thanks Very Much!

Required Namespaces:
System.Windows.Forms
System.Drawing


Code:
/// <summary>
/// A basic function that decides where the form should be located on screen
/// based on the required border and the screen resolution. This is usually
/// used for main forms, such as the MDI object.
/// </summary>
/// <param name="verticalBorder">
/// The required vertical border (space between the edge of the screen and the form).
/// </param>
/// <param name="horizontalBorder">
/// The required horizontal border (space between the edge of the screen and the form).
/// </param>
/// <returns>
/// Returns the exact size of the form object, including the calculated borders.
/// </returns>
public static Size SetWindowSize(int verticalBorder, int horizontalBorder)
	{
		// Create the fields to store the border information.
		int theHeight, theWidth;

		// Compute the exact height and width of the form.
		theHeight	= Screen.PrimaryScreen.WorkingArea.Height	- verticalBorder;
		theWidth	= Screen.PrimaryScreen.WorkingArea.Width	- horizontalBorder;

		// Return the new size to the calling function.
		return new Size(theWidth, theHeight);
	}
Code:
// Get the size for the form.
this.Size = common.SetWindowSize(10, 10);
this.CenterToScreen();