How to control dimensions?

  • Thread starter Thread starter C# newbie
  • Start date Start date
C

C# newbie

Hi, does anybody know how to find out of dimension of a screen?
let's say we have an application which should run on different PCs, laptops
and ... then we have to write the application in a way to sense the
dimension of the platform (or target platform) it's running or will be
running on.
I had written a program on PC when I ran it on Laptop, its dialog or form
occupied more 90% of the screen. So, program needs to know how conform
itself with new environment.

Any suggestions ?

Thanks in advance. Please write me in details if you have time otherwise
don't leave only a word. it only makes me confused. thanks again.
 
Hi, does anybody know how to find out of dimension of a screen?
let's say we have an application which should run on different PCs,
laptops and ... then we have to write the application in a way to
sense the dimension of the platform (or target platform) it's running
or will be running on.
I had written a program on PC when I ran it on Laptop, its dialog or
form occupied more 90% of the screen. So, program needs to know how
conform itself with new environment.


You can use System.Windows.Forms.Screen class to figure this stuff out.
Specifically, use Screen.PrimaryScreen.Bounds if you want to know the
full screen size, or Screen.PrimaryScreen.WorkingArea if you don't want
to include task bars and such.

using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;

namespace Y
{
public class MyClass
{
public static bool Done = false;

public static void Main()
{
Console.WriteLine(string.Format("w={0};h={1}",
Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
Console.WriteLine(string.Format("w={0};h={1}",
Screen.PrimaryScreen.WorkingArea.Width,
Screen.PrimaryScreen.WorkingArea.Height));
Console.ReadLine();
}
}
}

-mdb
 
Micheal thanks for your great hlep.

regards

Michael Bray said:
You can use System.Windows.Forms.Screen class to figure this stuff out.
Specifically, use Screen.PrimaryScreen.Bounds if you want to know the
full screen size, or Screen.PrimaryScreen.WorkingArea if you don't want
to include task bars and such.

using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;

namespace Y
{
public class MyClass
{
public static bool Done = false;

public static void Main()
{
Console.WriteLine(string.Format("w={0};h={1}",
Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
Console.WriteLine(string.Format("w={0};h={1}",
Screen.PrimaryScreen.WorkingArea.Width,
Screen.PrimaryScreen.WorkingArea.Height));
Console.ReadLine();
}
}
}

-mdb
 
Back
Top