如何在C#Windows窗体中的特定位置放置打开窗体? [英] How to position the opening form at specific location in C# Windows Forms?

查看:63
本文介绍了如何在C#Windows窗体中的特定位置放置打开窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表单中的 Location 属性设置为0,0(属性窗口").但是,该窗体不会在指定的位置打开.我想念什么吗?

The Location property in the form is set to 0,0 (Properties Window). However, the form doesn't open at the specified location. Am I missing something?

推荐答案

您需要将 StartPosition 设置为手动,以将表单的开始位置设置为 Location 中的值财产.

You need to set StartPosition to manual to make the form set start position to the value in Location Property.

public Form1()
{
    InitializeComponent();
    this.StartPosition = FormStartPosition.Manual;
    this.Location = new Point(0, 0);
}

FormStartPosition.Manual

FormStartPosition FormStartPosition.Manual

FormStartPosition FormStartPosition.Manual

表单的位置由System.Windows.Forms.Control.Location属性确定.

这篇关于如何在C#Windows窗体中的特定位置放置打开窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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