请选择 进入手机版 | 继续访问电脑版

马上加入IBC程序猿 各种源码随意下,各种教程随便看! 注册 每日签到 加入编程讨论群

C#教程 ASP.NET教程 C#视频教程程序源码享受不尽 C#技术求助 ASP.NET技术求助

【源码下载】 社群合作 申请版主 程序开发 【远程协助】 每天乐一乐 每日签到 【承接外包项目】 面试-葵花宝典下载

官方一群:

官方二群:

winform强制扩展屏显示应用

  [复制链接]
查看4730 | 回复9 | 2021-3-20 23:04:25 | 显示全部楼层 |阅读模式
本帖最后由 huok 于 2021-3-20 23:05 编辑

//在窗体的OnLoad事件中调用该方法  
protected void Form1_OnLoad(...) {  
    showOnMonitor(1);//index=1  
}  

private void showOnMonitor(int showOnMonitor)   
{   
    Screen[] sc;   
    sc = Screen.AllScreens;   
    if (showOnMonitor >= sc.Length) {  
        showOnMonitor = 0;  
    }  


    this.StartPosition = FormStartPosition.Manual;   
    this.Location = new Point(sc[showOnMonitor].Bounds.Left, sc[showOnMonitor].Bounds.Top);  
    // If you intend the form to be maximized, change it to normal then maximized.  
    this.WindowState = FormWindowState.Normal;  
    this.WindowState = FormWindowState.Maximized;  
}  

ibcadmin | 2021-3-21 17:48:10 | 显示全部楼层
+1
C#论坛 www.ibcibc.com IBC编程社区
C#
C#论坛
IBC编程社区
CLRSCR | 2021-3-23 10:30:26 | 显示全部楼层
+2 学习
朱。。。 | 2021-4-29 15:10:38 | 显示全部楼层
控件怎么自动适应这个呢?
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则