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

首頁 > 學院 > 開發設計 > 正文

C#如何實現帶消息數的App圖標

2019-11-14 13:41:37
字體:
來源:轉載
供稿:網友

  上次寫了一篇博文,但是每次更新圖標時,桌面會閃爍(刷新),有博友說人家的圖標都不會刷新,還能動畫.我想了一下,如果要達到這個效果,可以用Form來實現,就是在Form中嵌入一個圖片,然后用一個label來動態顯示消息數,關鍵是將Form的邊框隱藏,背景設為透明即可.如果要有旋轉或者縮放動畫,都可以用C#來實現.

 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Windows.Forms; 9 10 namespace AOPDemo11 {12     public partial class AppIconMsg : Form13     {14         public AppIconMsg()15         {16             InitializeComponent();17             //設置背景為透明18             this.BackColor = Color.FromArgb(116, 164, 2);19             this.TransparencyKey = this.BackColor;  20             21         }22 23         PRivate void AppIconMsg_Load(object sender, EventArgs e)24         {25             this.Width = 64;26             this.Height = 64;27             this.label1.Text = "99";28             this.timer1.Enabled = true;29             30         }31 32         // Drag it around the screen33         private const int WM_NCHITTEST = 0x84;34         private const int HTCAPTION = 0x2;35         protected override void WndProc(ref Message m)36         {37             //Disable mouseDoubleClick on form38             if (m.Msg == WM_LBUTTONDBLCLK)39             {40                 Form2 frm = new Form2(msg);41                 frm.Show();42                 //this.Close();43                 return;44             }45 46             if (m.Msg == WM_NCLBUTTONDBLCLK)47             {48                 Form2 frm = new Form2(msg);49                 frm.Show();50                // this.Close();51                 return;52             }53 54             //drag55             if (m.Msg == WM_NCHITTEST)56                 m.Result = new IntPtr(HTCAPTION);57             else58                 base.WndProc(ref m);59         }60         private int msg = 0;61         private void timer1_Tick(object sender, EventArgs e)62         {63             int num = new Random().Next(1, 100);64             msg = num;65             this.label1.Text = num.ToString();66         }67 68         const int WM_LBUTTONDBLCLK = 0x0203;//client area69         const int WM_NCLBUTTONDBLCLK = 0x00A3;//non-client area70         private void toolStripExit_Click(object sender, EventArgs e)71         {72             this.Close();73         }74 75     }76 }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 华亭县| 克山县| 垣曲县| 商丘市| 洪洞县| 翁牛特旗| 锡林郭勒盟| 金堂县| 天台县| 石阡县| 贺兰县| 尼玛县| 泰州市| 石门县| 吉隆县| 泾川县| 德昌县| 清水县| 五指山市| 泸水县| 淄博市| 观塘区| 龙陵县| 七台河市| 玛多县| 云霄县| 香港| 无为县| 同德县| 元阳县| 务川| 湘西| 金昌市| 合作市| 乐东| 东辽县| 普定县| 阜新| 南皮县| 海林市| 阳春市|