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

有如下选项,分别含义如下: CenterParent                    窗体在其父窗体中居中.      CenterScreen                    窗体在当前显示窗口中居中,其尺寸在窗体大小中指定.      Manual                             窗体的位置由   Location   属性确定.      WindowsDefaultBounds     窗体定位在   Windows   默认位置,其边界也由   Wi…
1.让窗体在启动时在指定位置出现 form1.StartPosition Manual CenterScreen WindowsDefaultLocation (default) WindowsDefaultBounds CenterParent // 父窗体的中间 只有在窗体启动前设置才有效. 故只有设置StartPosition 属性放在窗体构造函数中:而不能放在Load事件中. 也就是说在窗体第一次显示时的位置是跟窗体的StartPosition属性有关的,第一次显示以后就只和窗体的Loc…
窗体起始位置为顶部中间,WinForm居中显示: ; ; this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定 this.Location = (Point)new Size(x, y); //窗体的起始位置为(x,y) 其他注意点: System.Windows.Forms.SystemInformation.WorkingArea.Width //屏幕宽度 System.Windows.Forms.System…
窗体起始位置为顶部中间,WinForm居中显示: ; ; this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定 this.Location = (Point)new Size(x, y); //窗体的起始位置为(x,y) 其他注意点: System.Windows.Forms.SystemInformation.WorkingArea.Width //屏幕宽度 System.Windows.Forms.System…
StartPosition属性有如下选项,分别含义如下: CenterParent 窗体在其父窗体中居中. CenterScreen 窗体在当前显示窗口中居中,其尺寸在窗体大小中指定. Manual 窗体的位置由 Location 属性确定. WindowsDefaultBounds 窗体定位在 Windows 默认位置,其边界也由 Windows 默认决定. WindowsDefaultLocation 窗体定位在 Windows 默认位置,其尺寸在窗体大小中指定. CenterScreen的…
通过Form的Position属性可设置窗体的初始位置,如选择DesktopCenter为桌面中心,ScreenCenter为屏幕中心,等等. 这个属性在很多时候简化了程序代码. 但是,如果设置了position为ScreenCenter和DesktopCenter等,在窗体oncreate和onshow事件中使用代码控制窗体的位置就会不成功了,无论设置Self.Top,Self.Left为什么值,最后窗体都会自动根据Position自动调整位置. 我使用下面方法去在设置了position之后在…
CenterParent 窗体在其父窗体中居中. CenterScreen 窗体在当前显示窗口中居中,其尺寸在窗体大小中指定. Manual 窗体的位置由 Location 属性确定. WindowsDefaultBounds 窗体定位在 Windows 默认位置,其边界也由 Windows 默认决定. WindowsDefaultLocation 窗体定位在 Windows 默认位置,其尺寸在窗体大小中指定. 也就是说,CenterScreen的意思并不是屏幕居中(是相对的),它是在"当前显示…
CenterParent                     窗体在其父窗体中居中.       CenterScreen                    窗体在当前显示窗口中居中,其尺寸在窗体大小中指定.       Manual                               窗体的位置由   Location   属性确定.       WindowsDefaultBounds     窗体定位在   Windows   默认位置,其边界也由   Windows  …
一.C#中弹出窗口位置 加入命名空间 using System.Drawing using System.Windows.Forms 假定窗口名为form1,则 //窗体位置在屏幕中间 form1.StartPosition = FormStartPosition.CenterScreen; //窗体在其父窗口中间 form1.StartPosition = FormStartPosition.CenterParent; //窗体在有其空间的Location属性而定 form1.StartPos…
Winfrom 窗体弹出位置设定,其实就是两种模式,第一种模式是通过Winform提供的属性来设定:第二种模式是自定义,可以相对于软件本身,也可以是相对于屏幕. 一.第一种模式 使用Winform提供的属性来设定窗体弹出的位置 举个例子 Form form1=new Form(); form1.StartPosition = FormStartPosition.CenterScreen;//窗体位置在屏幕中间 form1.StartPosition = FormStartPosition.Cen…