With this code you get the screen resolution and the DPI number:
int deskHeight = Screen.PrimaryScreen.Bounds.Height;
int deskWidth = Screen.PrimaryScreen.Bounds.Width;
int currentDPI = 0;
using (Graphics g = this.CreateGraphics())
{
currentDPI = (int)g.DpiX;
}
MessageBox.Show("Your screen resolution is " + deskWidth + "x" + deskHeight);
MessageBox.Show("Your dpi is " + currentDPI);