QQ项目之八显示退出效果

举报
tea_year 发表于 2021/12/30 01:24:55 2021/12/30
1k+ 0 0
【摘要】 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows...

      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)
              {
              }
          }
      }
  
 

文章来源: aaaedu.blog.csdn.net,作者:tea_year,版权归原作者所有,如需转载,请联系作者。

原文链接:aaaedu.blog.csdn.net/article/details/50486884

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

作者其他文章

评论(0

抱歉,系统识别当前为高风险访问,暂不支持该操作

    全部回复

    上滑加载中

    设置昵称

    在此一键设置昵称,即可参与社区互动!

    *长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

    *长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。