11智能在线
新记
C#WinForm中如何修改窗体显示的位置?
我知道在窗体的属性中StartPosition属性是确定窗体位置的,但是就那么几种位置!可是我想实现窗体在右下角显示,这该怎么实现?没这个选项啊,有知道的帮帮忙,先谢谢了~
举报该文章
相关建议 2012-07-09
将屏幕工作区域大小减去你的窗体大小就好了啊
private void Form1_Load(object sender, EventArgs e)
{
this.Location = new Point(
Screen.PrimaryScreen.WorkingArea.Width - this.Size.Width, //屏幕工作区域减去窗体宽度
Screen.PrimaryScreen.WorkingArea.Width - this.Size.Height); //屏幕工作区域减去窗体高度
}
注意不要使用Screen.PrimaryScreen.Bounds.Width 因为任务栏会遮挡住也会占用屏幕区域。
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/ss78fp8vv.html
其他看法
第1个回答 2012-07-09
private void Form1_Load(object sender, EventArgs e)
{
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width-400, Screen.PrimaryScreen.Bounds.Height-400);
}
第2个回答 2012-07-09
你好!
winform每个窗体都可以自定义位置的,通过StartPosition的Manual属性,即通过location位移来确定窗体的起始位置。不可能直接一个属性就让你在右下角显示的,这个要自己去算。
本回答被网友采纳
第3个回答 2012-07-09
恶补的
第4个回答 2012-07-09
楼上正常, 自己算一下就是了.
相似回答
大家正在搜
相关问题
winform运行中怎么用C# 代码调整窗口位置,特别是怎么...
C#WINFORM窗体.定义FORM2显示在FORM1的固定...
C#Winform中,窗体大小怎么改变?
winfrom窗体怎么让子窗体在父窗体中固定位置显示看上去是...
C# WinForm窗体界面设置问题
winform中如何获取控件在窗体上位置?
C#中winform程序,如何实现在窗体中任意位置显示任意大...
c#中如何实现窗体名称的居中显示