高分求助!怎样用C#实现将控件像QQ一样自动停靠,自动隐藏?

高分求助!怎样用C#实现将控件像QQ一样自动停靠,自动隐藏?主要是知道具体如何实现的!切勿给个网址之类的!

private void timer2_Tick(object sender, EventArgs e)
{
if (UserHelp.personalInfoFormOpen == false)
{
getuser(UserHelp.loginId);
pictureBox1.Image = imageList1.Images[Convert.ToInt32(UserHelp.faceId)];
label1.Text = UserHelp.userNickName;
}
#region 窗体移动到屏幕两边发生的变化
Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this); //获取屏幕高,宽
int h=this.Height; //获取窗体的高度
if (this.Left < -126)
{
this.Top = 1;
this.Left = 0;
this.Height = ScreenArea.Height; //屏幕 高
}
if (this.Left >= ScreenArea.Width - 126)
{
this.Top = 1;
this.Left = ScreenArea.Width - 252;
this.Height = ScreenArea.Height;
}
if (this.Left > 0 && this.Left < ScreenArea.Width - 252)
{
this.Height = 551;
}
if (this.Top<=0)
{
this.Top = h - 2*h+5;
}
#endregion

} private void MainForm_MouseHover(object sender, EventArgs e)
{
if (this.Top < -100)
{
this.Top = 1;
}
}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答
大家正在搜