TA的每日心情 | 无聊 2022-5-4 12:19 |
---|
签到天数: 243 天 [LV.8]以坛为家I
论坛元老
 
- 积分
- 7181
|
马上加入IBC,查看更多教程
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 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;
}
|
|