如何在屏幕右侧打开窗口 [英] How to open window right side in screen

查看:112
本文介绍了如何在屏幕右侧打开窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置窗口属性或代码,以在屏幕右侧打开窗口窗体,并从上到下以全尺寸显示,而我想要的则更少.
谁能帮助我解决此问题.

How to set a Window properties or code, to open window form to right side of screen and full size from top to bottom and little less whatever i want.
Can anybody help me to resolve this problem.

推荐答案

将StartPosition属性设置为Manual.使用Load事件更改位置,最早您将知道窗口的实际大小:

Set the StartPosition property to Manual. Use the Load event to change the position, the earliest you''ll know the actual size of the window:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        this.StartPosition = FormStartPosition.Manual;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        Screen scr = Screen.FromPoint(this.Location);
        this.Location = new Point(scr.WorkingArea.Right - this.Width, scr.WorkingArea.Top);
    }
}



干杯



Cheers


这篇关于如何在屏幕右侧打开窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆