c# winform 怎样让窗体启动位置位于屏幕右上角
c#winform怎样让窗体启动位置位于屏幕右上角,就像QQ登陆后,默认的位置在电脑屏幕的右上角.谢谢,最好有代码,谢谢!!!同样,像QQ窗体一样,将其拖向屏幕的边界,就...
c# winform 怎样让窗体启动位置位于屏幕右上角,就像QQ登陆后,默认的位置在电脑屏幕的右上角.谢谢,最好有代码,谢谢!!!
同样,像QQ窗体一样,将其拖向屏幕的边界,就自动缩进去,鼠标移上去又显出来是怎么回事呢? 展开
同样,像QQ窗体一样,将其拖向屏幕的边界,就自动缩进去,鼠标移上去又显出来是怎么回事呢? 展开
4个回答
展开全部
如QQ窗口一样的代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
int state;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
this.Top = 0;
state = 0;
}
private void Form1_MouseEnter(object sender, EventArgs e)
{
if (state == 0)
{
state = 1;
int t = this.Top;
for (int i = t; i <= 0; i++)
{
this.Top = i;
Application.DoEvents();
}
state = 0;
}
}
private void Form1_MouseLeave(object sender, EventArgs e)
{
if (this.Top <= 0 && state==0)
{
state = 1;
int t=this.Top;
for (int i = t; i > -this.Height + 10; i--)
{
this.Top = i;
Application.DoEvents();
}
state = 0;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
int state;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
this.Top = 0;
state = 0;
}
private void Form1_MouseEnter(object sender, EventArgs e)
{
if (state == 0)
{
state = 1;
int t = this.Top;
for (int i = t; i <= 0; i++)
{
this.Top = i;
Application.DoEvents();
}
state = 0;
}
}
private void Form1_MouseLeave(object sender, EventArgs e)
{
if (this.Top <= 0 && state==0)
{
state = 1;
int t=this.Top;
for (int i = t; i > -this.Height + 10; i--)
{
this.Top = i;
Application.DoEvents();
}
state = 0;
}
}
}
}
展开全部
private void Form5_Load(object sender, EventArgs e)
{
int x = SystemInformation.PrimaryMonitorSize.Width - this.Width;
int y= SystemInformation.PrimaryMonitorSize.Height - this.Height;//要让窗体往上走 只需改变 Y的坐标
this.Location = new Point(x, y);
this.TopMost = true;
}
{
int x = SystemInformation.PrimaryMonitorSize.Width - this.Width;
int y= SystemInformation.PrimaryMonitorSize.Height - this.Height;//要让窗体往上走 只需改变 Y的坐标
this.Location = new Point(x, y);
this.TopMost = true;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
private void Form2_Load(object sender, EventArgs e)
{
this.Left = 1000;
this.Top = 0;
}
类似的,不过你要获取分辨率
分辨率的话
Rectangle rect = new Rectangle();
rect = Screen.GetWorkingArea(this);
MessageBox.Show("本机器的分辨率是" + rect.Width.ToString() + "*" + rect.Height.ToString());
类似的就可以获取
{
this.Left = 1000;
this.Top = 0;
}
类似的,不过你要获取分辨率
分辨率的话
Rectangle rect = new Rectangle();
rect = Screen.GetWorkingArea(this);
MessageBox.Show("本机器的分辨率是" + rect.Width.ToString() + "*" + rect.Height.ToString());
类似的就可以获取
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
this.ControlBox = false;
或者
this.FormBorderStyle = FormBorderStyle.None;
或者
this.FormBorderStyle = FormBorderStyle.None;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询