亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#實(shí)現(xiàn)帶消息數(shù)的App圖標(biāo)

 更新時(shí)間:2015年12月10日 08:58:28   投稿:hebedich  
這篇文章主要介紹了如何使用C#實(shí)現(xiàn)帶消息數(shù)的App圖標(biāo)的方法,并附上全部源碼,分享給大家,有需要的小伙伴可以參考下。

上次寫(xiě)了一篇博文,但是每次更新圖標(biāo)時(shí),桌面會(huì)閃爍(刷新)http://chabaoo.cn/article/73350.htm,有博友說(shuō)人家的圖標(biāo)都不會(huì)刷新,還能動(dòng)畫(huà).我想了一下,如果要達(dá)到這個(gè)效果,可以用Form來(lái)實(shí)現(xiàn),就是在Form中嵌入一個(gè)圖片,然后用一個(gè)label來(lái)動(dòng)態(tài)顯示消息數(shù),關(guān)鍵是將Form的邊框隱藏,背景設(shè)為透明即可.如果要有旋轉(zhuǎn)或者縮放動(dòng)畫(huà),都可以用C#來(lái)實(shí)現(xiàn).

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 AOPDemo
{
  public partial class AppIconMsg : Form
  {
    public AppIconMsg()
    {
      InitializeComponent();
      //設(shè)置背景為透明
      this.BackColor = Color.FromArgb(116, 164, 2);
      this.TransparencyKey = this.BackColor; 
      
    }

    private void AppIconMsg_Load(object sender, EventArgs e)
    {
      this.Width = 64;
      this.Height = 64;
      this.label1.Text = "99";
      this.timer1.Enabled = true;
      
    }

    // Drag it around the screen
    private const int WM_NCHITTEST = 0x84;
    private const int HTCAPTION = 0x2;
    protected override void WndProc(ref Message m)
    {
      //Disable mouseDoubleClick on form
      if (m.Msg == WM_LBUTTONDBLCLK)
      {
        Form2 frm = new Form2(msg);
        frm.Show();
        //this.Close();
        return;
      }

      if (m.Msg == WM_NCLBUTTONDBLCLK)
      {
        Form2 frm = new Form2(msg);
        frm.Show();
        // this.Close();
        return;
      }

      //drag
      if (m.Msg == WM_NCHITTEST)
        m.Result = new IntPtr(HTCAPTION);
      else
        base.WndProc(ref m);
    }
    private int msg = 0;
    private void timer1_Tick(object sender, EventArgs e)
    {
      int num = new Random().Next(1, 100);
      msg = num;
      this.label1.Text = num.ToString();
    }

    const int WM_LBUTTONDBLCLK = 0x0203;//client area
    const int WM_NCLBUTTONDBLCLK = 0x00A3;//non-client area
    private void toolStripExit_Click(object sender, EventArgs e)
    {
      this.Close();
    }

  }
}

相關(guān)文章

最新評(píng)論