zoukankan      html  css  js  c++  java
  • c# winform 多屏显示

    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;
    using System.Configuration;

    namespace WinClient
    {
        public partial class MainForm : Form
        {
            public MainForm()
            {
                InitializeComponent();
            }
            
            private void MainForm_Load(object sender, EventArgs e)
            {
                try
                {
                    //设置窗体无边框
                    this.FormBorderStyle = FormBorderStyle.None;
                    //窗口置顶
                    this.TopMost = true;
                    //开始位置由 Location 决定
                    this.StartPosition = FormStartPosition.Manual;

                    Screen[] screens = System.Windows.Forms.Screen.AllScreens;
                    if (screens.Length >= 2)
                    {
                        //获取扩展屏
                        Screen childerScreen = screens[1];
                        //设置宽高
                        this.Width = childerScreen.Bounds.Width;
                        this.Height = childerScreen.Bounds.Height;
                        //设置显示位置
                        this.Location = childerScreen.WorkingArea.Location;
                    }
                    else
                    {
                        MessageBox.Show("只有一个显示器");
                    }
                }
                catch (Exception ex)
                {
                    //错误日志处理
                }
            }
        }
    }

    完整代码下载地址

  • 相关阅读:
    react深入学习(资料,案例)
    match.exec深入学习
    实用插件表格行列隐藏显示
    下拉选项插件的实现
    表格操作eventTable
    [CentOS7] 挂载iso镜像文件到/media目录下
    [CentOS7] 设置开机启动方式(图形界面或命令行)
    [CentOS7] 磁盘分区(gdisk, fdisk)
    [CentOS7] minimal安装后 出现 没有ifconfig 无法ping 无法yum could not retrieve mirrorlist http://mirrorlist.centos.org/
    [C++]C,C++中使用可变参数
  • 原文地址:https://www.cnblogs.com/zeshao/p/8006668.html
Copyright © 2011-2022 走看看