C#: A képernyő felbontásának lekérdezése

Programozással kapcsolatos cikkek / C# (1224 katt)

Ha a képernyő felbontását szeretnénk lekérdezni Winforms és egy képernyő használata esetén, akkor a következő programmal tehetjük meg:

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;

namespace ScreenResolution
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
int width = Screen.PrimaryScreen.Bounds.Width;
int height = Screen.PrimaryScreen.Bounds.Height;

MessageBox.Show("The screen resolution is: " +
width.ToString() + " x " + height.ToString());
}
}
}

Előző oldal Kapitány