Thursday, September 2, 2010

Using C # to get the screen resolution

Core Tip: using System.Windows.Forms; for screen resolution int SH = Screen.PrimaryScreen.Bounds.Height; int SW = Screen.PrimaryScreen.Bounds.Width; access window centered Top and Left int ...
using System.Windows.Forms;Get screen resolution
int SH = Screen.PrimaryScreen.Bounds.Height;
int SW = Screen.PrimaryScreen.Bounds.Width;


Top and Left for the window centered
int thisH = 100;
int thisW = 200;
int SH = (Screen.PrimaryScreen.Bounds.Height - 30 - thisH) / 2;
int SW = (Screen.PrimaryScreen.Bounds.Width - 10 - thisW) / 2;

No comments:

Post a Comment