如何定位在C#Windows窗体左上角开放的形式? [英] How to position the opening form at the top left corner in C# Windows Forms?

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

问题描述

在表单中的位置属性设置为0,0(属性窗口)。然而,形式中的任何位置,但在屏幕的左上角打开。我应该尝试什么代码,我应该在哪里把它?

The Location property in the form is set to 0,0 (Properties Window). However, the form opens in any location but the top left corner of the screen. What code should I try and where should I place it?

我是新的C#,任何帮助深表感谢。

I'm new to C#, any help is much appreciated.

推荐答案

您需要设置中StartPosition 来手工制作的<$ C $的形式设置起始位置值C>位置属性。

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天全站免登陆