窗体位置设置StartPosition属性

有如下选项,分别含义如下:

CenterParent                    窗体在其父窗体中居中。    
  CenterScreen                    窗体在当前显示窗口中居中,其尺寸在窗体大小中指定。    
  Manual                             窗体的位置由   Location   属性确定。    
  WindowsDefaultBounds     窗体定位在   Windows   默认位置,其边界也由   Windows   默认决定。    
  WindowsDefaultLocation    窗体定位在   Windows   默认位置,其尺寸在窗体大小中指定。     
    
CenterScreen的意思并不是屏幕居中(是相对的),它是在"当前显示窗口"中居中。

当用Show()方法时应选择CenterScreen,窗体进度条可以使用

用ShowDialog()方法时应选择CenterParent,这样才能让要显示的窗口居中,活动窗体为弹出的窗体。

窗体位置设置StartPosition属性

时间: 2024-08-03 20:26:23

窗体位置设置StartPosition属性的相关文章

c# winform 窗体起始位置 设置

窗体起始位置为顶部中间,WinForm居中显示: int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width) / 2; int y = (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Size.Height) / 2; this.StartPosition = FormStartPosition.Manu

C# winfrom 窗体的StartPosition 属性

StartPosition属性有如下选项,分别含义如下: CenterParent 窗体在其父窗体中居中. CenterScreen 窗体在当前显示窗口中居中,其尺寸在窗体大小中指定. Manual 窗体的位置由 Location 属性确定. WindowsDefaultBounds 窗体定位在 Windows 默认位置,其边界也由 Windows 默认决定. WindowsDefaultLocation 窗体定位在 Windows 默认位置,其尺寸在窗体大小中指定. CenterScreen的

WindowsForm窗体位置

WindowsForm的窗体,是winForm程序的基本单元.窗体的大小和位置是如何控制的呢? 先看窗体的几个属性.如下图所示 一. 设置窗体起始位置居中 窗口默认是在左上角的,可以用微软定义好的FormStartPosition属性来配置为居中: this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 等同于 这个属性的其他值也可以了解下: 属性值 说明 CenterParent 在其父窗体中居中 Ma

C# 窗体位置 Show和ShowDialog(转)

CenterParent 窗体在其父窗体中居中. CenterScreen 窗体在当前显示窗口中居中,其尺寸在窗体大小中指定. Manual 窗体的位置由 Location 属性确定. WindowsDefaultBounds 窗体定位在 Windows 默认位置,其边界也由 Windows 默认决定. WindowsDefaultLocation 窗体定位在 Windows 默认位置,其尺寸在窗体大小中指定. 也就是说,CenterScreen的意思并不是屏幕居中(是相对的),它是在"当前显示

C# 弹出窗体位置设定

一.C#中弹出窗口位置 加入命名空间using System.Drawing和using System.Windows.Forms假定窗口名为form1,则 form1.StartPosition = FormStartPosition.CenterScreen;窗体位置在屏幕中间  form1.StartPosition = FormStartPosition.CenterParent;窗体在其父窗口中间  form1.StartPosition = FormStartPosition.Man

Css3之基础-10 Css列表(列表项标志 、列表项图像、列表项位置、列表属性)

一.CSS 列表样式 列表项标志 list-style-type - list-style-type 属性用于控制列表中列表项标志的样式 - 无序列表: 出现在各列表项旁边的圆点 - 有序列表: 可能是字母.数字或另外某种计数体系中的一个符号 - 无序列表取值 - none    : 无标记 - disc    : 实心圆,为默认值 - circle  : 空心圆 - square  : 实心方块 - 有序列表取值 - none    : 无标记 - decimal : 无标记 - lower-

移动窗体(边框设置为None后的窗体)

1 #region 移动窗体(边框设置为None后的窗体) 2 3 /// <summary> 4 /// 重写WndProc方法,实现窗体移动和禁止双击最大化 5 /// </summary> 6 /// <param name="m">Windows 消息</param> 7 protected override void WndProc(ref Message m) 8 { 9 switch (m.Msg) 10 { 11 case

C# winform 跨线程更改窗体控件的属性

当winform程序中新开一个线程,是无法改变主线程中窗体控件的属性的,否则运行时会报错. 若想在其他线程中控制主线程中的窗体控件,则必须利用BeginInvoke方法. 例如:添加一个名为textbox1的TextBox控件,想将它的Visible设置为false,则执行下面的代码即可 textbox1.BeginInvoke(new Action(() => { textbox1.Visible= false; })); 另外WPF中,想达到winform同样的效果,利用Dispatcher

文字用一个label标签包起来,设置一个属性:for,其for的值要和复选框的id相同。

<p> 1.通过点击文字,就选中复选框</p> <p>文字用一个label标签包起来,设置一个属性:for,其for的值要和复选框的id相同.</p> <p> 例如:<input id="Checkbox6" value="6" name="box" type="checkbox" /><label for="Checkbox6"