国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

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

2020-01-24 01:20:30
字體:
供稿:網(wǎng)友

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

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 曲麻莱县| 东辽县| 武清区| 霍林郭勒市| 黎城县| 巴青县| 吴忠市| 洪泽县| 修文县| 安龙县| 晋中市| 如东县| 贞丰县| 青铜峡市| 高邮市| 滨州市| 威远县| 汉寿县| 湖北省| 城固县| 郸城县| 黄梅县| 徐州市| 双辽市| 皮山县| 固阳县| 虎林市| 南丹县| 潼南县| 漠河县| 永修县| 沈丘县| 南雄市| 永胜县| 墨脱县| 吴川市| 工布江达县| 台江县| 油尖旺区| 兴和县| 北流市|