QQ项目之八显示退出效果

134 篇文章 21 订阅
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)
        {

        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

teayear

读后有收获可以获取更多资源

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值