資源簡介
【實例簡介】
C# 實現(xiàn)動態(tài)托盤圖標(biāo) 可替換任意圖像
【核心代碼】
private void timer_Tick(object sender, EventArgs e) { //根據(jù)指定的類型依次設(shè)置相應(yīng)的圖標(biāo)實現(xiàn)動態(tài)效果 switch (type) { case 1: if (c == 0) { notifyIcon.Icon = Properties.Resources.stop; c ; } else { c = 0; notifyIcon.Icon = Properties.Resources._null; } break; case 2: if (c == 0) { notifyIcon.Icon = Properties.Resources.pixel1; c ; } else if (c == 1) { notifyIcon.Icon = Properties.Resources.pixel2; c ; } else if (c == 2) { notifyIcon.Icon = Properties.Resources.pixel3; c ; } else if (c == 3) { notifyIcon.Icon = Properties.Resources.pixel4; c ; } else { c = 0; notifyIcon.Icon = Properties.Resources._null; } break; case 3: if (c == 0) { notifyIcon.Icon = Properties.Resources.circle1; c ; } else if (c == 1) { notifyIcon.Icon = Properties.Resources.circle2; c ; } else if (c == 2) { notifyIcon.Icon = Properties.Resources.circle3; c ; } else if (c == 3) { notifyIcon.Icon = Properties.Resources.circle4; c ; } else if (c == 4) { notifyIcon.Icon = Properties.Resources.circle5; c = 0; } break; case 4: if (c == 0) { notifyIcon.Icon = (Icon)Properties.Resources.arrow1; c ; } else if (c == 1) { notifyIcon.Icon = Properties.Resources.arrow2; c ; } else if (c == 2) { notifyIcon.Icon = Properties.Resources.arrow3; c ; } else if (c == 3) { notifyIcon.Icon = Properties.Resources.arrow4; c = 0; } break; } }
代碼片段和文件信息
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?HelloCsharp_ico
{
????public?partial?class?frmMain?:?Form
????{
????????public?frmMain()
????????{
????????????InitializeComponent();
????????}
????????public?int?type?=?1;
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????type?=?1;
????????}
????????private?void?trackBar_ValueChanged(object?sender?EventArgs?e)
????????{
????????????timer.Interval?=?trackBar.Value;
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????}
????????int?c?=?0;
????????private?void?timer_Tick(object?sender?EventArgs
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\
?????目錄???????????0??2014-07-22?23:03??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\
?????目錄???????????0??2014-07-23?13:19??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\Debug\
?????文件???????39936??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\Debug\HelloCsharp_ico.exe
?????文件???????38400??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\Debug\HelloCsharp_ico.pdb
?????文件???????22712??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\Debug\HelloCsharp_ico.vshost.exe
?????文件?????????490??2013-06-18?20:28??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\Debug\HelloCsharp_ico.vshost.exe.manifest
?????目錄???????????0??2014-07-22?23:03??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\bin\Release\
?????文件????????3011??2020-04-14?10:39??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\frmMain.cs
?????文件????????6874??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\frmMain.Designer.cs
?????文件????????6209??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\frmMain.resx
?????文件????????4770??2014-07-22?23:18??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\HelloCsharp_ico.csproj
?????文件????????5120??2014-08-02?01:20??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\HelloCsharp_ico.v12.suo
?????目錄???????????0??2014-07-22?22:28??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\
?????目錄???????????0??2014-07-22?22:28??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\
?????目錄???????????0??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\
?????文件???????37800??2014-08-02?01:20??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????8128??2014-08-02?01:20??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????2405??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.csproj.FileListAbsolute.txt
?????文件????????1450??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.csproj.GenerateResource.Cache
?????文件????????1759??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.csprojResolveAssemblyReference.cache
?????文件???????39936??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.exe
?????文件?????????180??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.frmMain.resources
?????文件???????38400??2014-08-02?01:21??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.pdb
?????文件???????27008??2014-07-22?23:18??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\HelloCsharp_ico.Properties.Resources.resources
?????目錄???????????0??2014-07-22?23:18??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\TempPE\
?????文件????????6144??2014-07-22?23:18??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件?????????498??2014-08-02?01:20??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\Program.cs
?????目錄???????????0??2014-07-22?23:15??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\Properties\
?????文件????????1407??2014-07-23?13:24??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\Properties\AssemblyInfo.cs
?????文件????????8634??2014-07-22?23:18??《實現(xiàn)動態(tài)托盤圖標(biāo)源碼》\Properties\Resources.Designer.cs
............此處省略19個文件信息
評論
共有 條評論