.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Screen Resolution Program in C#.net

Posted By:Narayanan       Posted Date: July 14, 2011    Points: 40    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Simply says, Display Resolution or Monitor Resolution. I give the demo for Screen Resolution. It's a very simple and easily understandable How to maximize a form without using Maximize Button?
 

Use this Code.

In the Namespace

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

//Form Loading

        private void Form1_Load(object sender, EventArgs e)
        {

            // To get Current Screen Resoltion

            int tempwidth = Screen.PrimaryScreen.Bounds.Width;

            int tempHeight = Screen.PrimaryScreen.Bounds.Height;

            int tempX = Screen.PrimaryScreen.Bounds.X;

            int tempY = Screen.PrimaryScreen.Bounds.Y;

 

            this.Width = tempwidth;

            this.Height = tempHeight-15;

            this.Location = new Point(tempX, tempY);

            dataGridView1.Width = tempwidth;

            dataGridView1.Height = tempHeight;

            int tempcol = tempwidth / 5;

            dataGridView1.Columns[0].Width = tempcol;

            dataGridView1.Columns[1].Width = tempcol;

            dataGridView1.Columns[2].Width = tempcol;

            dataGridView1.Columns[3].Width = tempcol;

            dataGridView1.Columns[4].Width = tempcol;

            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

        }

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend