当前位置:首页 >.NET > 正文内容

c#仿QQ会员右下角提示框

大滑稽11年前 (2014-03-24).NET1074
  1. 代码
     

  2. using  System;
     

  3. using System.Collections.Generic;
     

  4. using System.ComponentModel;
     

  5. using System.Data;
     

  6. using System.Drawing;
     

  7. using System.Linq;
     

  8. using System.Text;
     

  9. using System.Windows.Forms;
     

  10. using ClientSystem.ClientSystemServices;
     

  11. using BaseFunction;
     

  12. using System.Diagnostics;
     


  13.  

  14. namespace ClientSystem
     

  15. {
     

  16.     /// <summary>
     

  17.     /// 提示窗体  苏飞
     

  18.     /// </summary>
     

  19.     public partial class Messages : Form
     

  20.     {
     

  21.         public Messages()
     

  22.         {
     

  23.             InitializeComponent();
     

  24.         }
     

  25.         //营业厅完整信息
     

  26.         public OfficeInfo OfficeInfo { get; set; }
     


  27.  

  28.         #region //私有变量和方法
     


  29.  

  30.         private ClientSystemServices.Service1SoapClient user = new Service1SoapClient();
     


  31.  

  32.         //显示登录用户的计算机信息
     

  33.         public void ShowComptureInfo()
     

  34.         {
     

  35.             //CUP
     

  36.             //label9.Text = ComputerInfo.GetCpuID();
     


  37.  

  38.             //硬盘
     

  39.             //label26.Text = ComputerInfo.GetDiskID();
     


  40.  

  41.             //IP
     

  42.             lblIP.Text = ComputerInfo.GetIPAddress();
     


  43.  

  44.             //上次登录IP
     

  45.             lbloldIP.Text = ComputerInfo.GetIPAddress();
     


  46.  

  47.             //用户名
     

  48.             lblUser.Text = OfficeInfo.ofLogin + " 商户欢迎您";
     


  49.  

  50.             //计算机名称
     

  51.             //label21.Text = ComputerInfo.GetComputerName();
     


  52.  

  53.             //操作系统
     

  54.             //label23.Text = ComputerInfo.GetSystemType();
     


  55.  

  56.             //当前用户
     

  57.             //label25.Text = ComputerInfo.GetUserName();
     

  58.         }
     


  59.  

  60.         #endregion
     


  61.  

  62.         //界面加载
     

  63.         private void Messages_Load(object sender, EventArgs e)
     

  64.         {
     

  65.             try
     

  66.             {
     

  67.                 //让窗体加载时显示到右下角
     

  68.                 int x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - 255;
     

  69.                 int y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - 161;
     

  70.                 this.SetDesktopLocation(x, y);
     


  71.  

  72.                 //加载显示信息
     

  73.                 ShowComptureInfo();
     


  74.  

  75.                 //渐变显示这里表示加载
     

  76.                 caozuo = "load";
     

  77.                 this.Opacity = 0;
     

  78.             }
     

  79.             catch (Exception)
     

  80.             {
     


  81.  

  82.             }
     

  83.         }
     


  84.  

  85.         //关闭按钮
     

  86.         private void pictureBox1_Click(object sender, EventArgs e)
     

  87.         {
     

  88.             this.Close();
     

  89.         }
     


  90.  

  91.         //图片离开事件
     

  92.         private void pictureBox1_MouseLeave(object sender, EventArgs e)
     

  93.         {
     

  94.             pictureBox1.BackgroundImage = ClientSystem.Properties.Resources.lgintop;
     

  95.         }
     


  96.  

  97.         //图片进入事件
     

  98.         private void pictureBox1_MouseEnter(object sender, EventArgs e)
     

  99.         {
     

  100.             pictureBox1.BackgroundImage = ClientSystem.Properties.Resources.lgintop1;
     

  101.         }
     


  102.  

  103.         //修改密码
     

  104.         private void label6_Click(object sender, EventArgs e)
     

  105.         {
     

  106.             ChangePwd frm = new ChangePwd();
     

  107.             frm.OfficeInfo = this.OfficeInfo;
     

  108.             frm.Show();
     

  109.         }
     


  110.  

  111.         //系统官网
     

  112.         private void label7_Click(object sender, EventArgs e)
     

  113.         {
     

  114.             Process.Start("http://www.smxzc.com/");
     

  115.         }
     


  116.  

  117.         #region//拖动无标题窗体
     


  118.  

  119.         private bool isMouseDown = false;
     

  120.         private Point FormLocation;     //form的location
     

  121.         private Point mouseOffset;      //鼠标的按下位置
     


  122.  

  123.         //鼠标安下
     

  124.         private void Messages_MouseDown(object sender, MouseEventArgs e)
     

  125.         {
     

  126.             try
     

  127.             {
     

  128.                 if (e.Button == MouseButtons.Left)
     

  129.                 {
     

  130.                     isMouseDown = true;
     

  131.                     FormLocation = this.Location;
     

  132.                     mouseOffset = Control.MousePosition;
     

  133.                 }
     

  134.             }
     

  135.             catch (Exception)
     

  136.             {
     


  137.  

  138.             }
     

  139.         }
     


  140.  

  141.         //鼠标移动
     

  142.         private void Messages_MouseMove(object sender, MouseEventArgs e)
     

  143.         {
     

  144.             try
     

  145.             {
     

  146.                 int _x = 0;
     

  147.                 int _y = 0;
     

  148.                 if (isMouseDown)
     

  149.                 {
     

  150.                     Point pt = Control.MousePosition;
     

  151.                     _x = mouseOffset.X - pt.X;
     

  152.                     _y = mouseOffset.Y - pt.Y;
     


  153.  

  154.                     this.Location = new Point(FormLocation.X - _x, FormLocation.Y - _y);
     

  155.                 }
     

  156.             }
     

  157.             catch (Exception)
     

  158.             {
     


  159.  

  160.             }
     

  161.         }
     


  162.  

  163.         //鼠标松开
     

  164.         private void Messages_MouseUp(object sender, MouseEventArgs e)
     

  165.         {
     

  166.             try
     

  167.             {
     

  168.                 isMouseDown = false;
     

  169.             }
     

  170.             catch (Exception)
     

  171.             {
     


  172.  

  173.             }
     

  174.         }
     

  175.         #endregion
     


  176.  

  177.         //定时关闭窗体
     

  178.         private void timer1_Tick(object sender, EventArgs e)
     

  179.         {
     

  180.             timer2.Enabled = true;
     

  181.             caozuo = "close";//关闭窗体
     

  182.         }
     


  183.  

  184.         //进入窗体事件
     

  185.         private void Messages_MouseEnter(object sender, EventArgs e)
     

  186.         {
     

  187.             //停止定时关闭
     

  188.             timer1.Enabled = false;
     

  189.             //开始渐变加载
     

  190.             caozuo = "load";
     

  191.         }
     


  192.  

  193.         //窗体离开事件
     

  194.         private void Messages_MouseLeave(object sender, EventArgs e)
     

  195.         {
     

  196.             timer1.Enabled = true;
     

  197.         }
     


  198.  

  199.         string caozuo = "";
     


  200.  

  201.         //定时处理渐变的效果
     

  202.         private void timer2_Tick(object sender, EventArgs e)
     

  203.         {
     

  204.             if (caozuo == "load")
     

  205.             {
     

  206.                 this.Opacity += 0.09;
     

  207.             }
     

  208.             else if (caozuo == "close")
     

  209.             {
     

  210.                 this.Opacity = this.Opacity - 0.09;
     

  211.                 if (this.Opacity == 0)
     

  212.                     this.Close();
     

  213.             }
     

  214.         }
     

  215.     }
     

  216. }

扫描二维码推送至手机访问。

版权声明:本文由第★一★次发布,如需转载请注明出处。

本文链接:http://wpers.net/post/60.html

“c#仿QQ会员右下角提示框” 的相关文章

Cbo控件数据源绑定

 //Cbo控件数据源绑定DataTable DtType = noteType.GetTypeList("");         ...

C#遍历控件的方法

首先,要想遍历,就必须找到你想找的表单里面的所有控件,然后一个个的逐一比对,当找到了你需要的控件的时候,再做你需要的操作。1、foreach方法foreach (Control control in ...

Linq读写XML

         private List<News> GetNews(string html)    &n...

c#中分页显示数据

     //c#中分页显示数据    public partial class Form1 : Form    {  ...

C#修改浏览器主页

string key = @"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main";      &n...

c#各种Timer类的区别与使用

System.Threading.Timer 是一个简单的轻量计时器,它使用回调方法并由线程池线程提供服务。在必须更新用户界面的情况下,建议不要使用该计时器,因为它的回调不在用户界面线程上发生。在此类情况下,System.Windows....