Friday 23 November 2012

Get Screen Resolution In C#


 Get Page Resolution
Import
using System.Windows.Forms;
Namespace In your Page

Type The Query In your page ....
int height = Screen.PrimaryScreen.Bounds.Height;
int width = Screen.PrimaryScreen.Bounds.Width;

Set Resolution In Your Page In CodeBehind

Type the below query
In Aspx page


<body id="body" runat="server">
</body>
  
In Aspx.cs page


int screenWidth= Screen.PrimaryScreen.Bounds.Width;
body.Style.Add("width", Convert.ToString(screenWidth));

No comments:

Post a Comment