using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MYQQ
{
public partial class InfoForm : Form
{
public string myName; //用来显示登录昵称,传个昵称过来,显示在窗体标题上!
public InfoForm()
{
InitializeComponent();
}
private void InfoForm_Load(object sender, EventArgs e)
{
//初始化窗口出现位置,窗体的左上角位置,用来确定窗体的位置;
Point p = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width, Screen.PrimaryScreen.WorkingArea.Height - this.Height-20);
this.PointToScreen(p); //制定工作区的坐标,转换成屏幕坐标;
this.Location = p; //左上角的位置,是一个x,y组成的坐标(二维);
this.Text = myName;
//小时进制有待完善
try
{
int hour = DateTime.Now.Hour;
if(hour>=6 && hour<=12){
label3.Text="上午好";
}else if(hour>=12 && hour<18)
{
label3.Text="下午好";
}else{
label3.Text="晚上好";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//timer控制,自动隐藏!
private void timer1_Tick(object sender, EventArgs e)
{
//鼠标不在窗体内时
if (!this.Bounds.Contains(Cursor.Position))
{
this.Close();
}
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
QQ项目之八显示退出效果
于 2016-01-09 09:29:26 首次发布