LoginSignup
0
1

More than 3 years have passed since last update.

C# ディスプレイサイズを表示する

Posted at

やりたいこと

ディスプレイサイズを取得して表示する

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

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

        private void button1_Click(object sender, EventArgs e)
        {
            int disp_width = Screen.PrimaryScreen.Bounds.Width;
            int disp_height = Screen.PrimaryScreen.Bounds.Height;

            txtDispWidth.Text = disp_width.ToString();
            txtDispHeight.Text = disp_height.ToString();
        }
    }
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1