資源簡介
C#lrc歌詞顯示控件采用VS2005開發,測試DEMO集成了Windows media player可隨著歌曲的進度進行歌詞滾動,歌詞還可以定點跟隨,控件屬性有多種設置。包括顏色、字體、背靜、邊框等。

代碼片段和文件信息
using?System;
using?System.Drawing;
using?System.Drawing.Drawing2D;
using?System.Drawing.Imaging;
using?System.Runtime.InteropServices;
using?System.Windows.Forms;
namespace?LyricShow
{
????public?partial?class?frmDesktopLyric?:?Form
????{
????????public?frmDesktopLyric()
????????{
????????????InitializeComponent();
????????????//將窗體設置為支持透明背景
????????????this.Setstyle(Controlstyles.SupportsTransparentBackColor?true);
????????}
????????bool?enter?=?false;?internal?bool?trans?=?false;?????//鼠標是否已經移入歌詞區域、鼠標穿透是否已經開啟
????????internal?Bitmap?oldbitmap?=?new?Bitmap(1?1);????????//最后設置的位圖
????????internal?string?cache?=?““;??????????????????????????//最后設置的文本
????????internal?Color?border?=?Color.Black;?????????????????//邊框顏色
????????#region?屬性
????????protected?override?CreateParams?CreateParams
????????{
????????????get
????????????{
????????????????//重新定義窗體樣式
????????????????CreateParams?cp?=?base.CreateParams;
????????????????cp.Exstyle?|=?0x00080000;
????????????????return?cp;
????????????}
????????}
????????#endregion
????????#region?方法
????????private?void?CanPenetrate()
????????{
????????????//將窗體設置為鼠標可穿透
????????????uint?intExTemp?=?Win32.GetWindowLong(this.Handle?Win32.GWL_EXstyle);
????????????uint?oldGWLEx?=?Win32.SetWindowLong(this.Handle?Win32.GWL_EXstyle?Win32.WS_EX_TRANSPARENT?|?Win32.WS_EX_layerED);
????????????trans?=?true;
????????}
????????private?void?CancelPenetrate()
????????{
????????????//將窗體設置為鼠標不可穿透
????????????Win32.SetWindowLong(this.Handle?Win32.GWL_EXstyle?Win32.WS_EX_layerED);
????????????trans?=?false;
????????}
????????internal?void?Penetrate()
????????{
????????????//打開或關閉鼠標穿透
????????????if?(trans)?CancelPenetrate();
????????????else?CanPenetrate();
????????}
????????internal?void?SetBitmap(Bitmap?bitmap)
????????{
????????????SetBitmap(bitmap?255);
????????}
????????internal?void?SetBitmap(Bitmap?bitmap?byte?opacity)
????????{
????????????//設置位圖
????????????oldbitmap?=?bitmap;????//更新緩存
????????????if?(enter)
????????????{
????????????????//如果鼠標已經移入,重繪位圖,在bitmat之后增加背景
????????????????Bitmap?b?=?new?Bitmap(bitmap.Width?bitmap.Height);
????????????????Graphics?g?=?Graphics.FromImage(b);
????????????????GraphicsPath?roundedRect?=?new?GraphicsPath();
????????????????Rectangle?rect?=?new?Rectangle(0?0?bitmap.Width?-?1?bitmap.Height?-?1);
????????????????int?cornerRadius?=?5;
????????????????g.SmoothingMode?=?SmoothingMode.AntiAlias;
????????????????roundedRect.AddArc(rect.X?rect.Y?cornerRadius?*?2?cornerRadius?*?2?180?90);
????????????????roundedRect.AddLine(rect.X?+?cornerRadius?rect.Y?rect.Right?-?cornerRadius?*?2?rect.Y);
????????????????roundedRect.AddArc(rect.X?+?rect.Width?-?cornerRadius?*?2?rect.Y?cornerRadius?*?2?cornerRadius?*?2?270?90);
????????????????roundedRect.AddLine(rect.Right?rect.Y?+?cornerRadius?*?2?rect.Right?rect.Y?+?rect.Height?-?cornerRadius?*?2);
????????????????roundedRect.AddArc(r
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????22528??2015-03-27?00:05??LyricShow\LyricShow\bin\Debug\LyricShow.dll
?????文件??????42496??2015-03-27?00:05??LyricShow\LyricShow\bin\Debug\LyricShow.pdb
?????文件??????10048??2014-11-30?18:12??LyricShow\LyricShow\frmDesktopLyric.cs
?????文件???????1969??2014-11-30?18:12??LyricShow\LyricShow\frmDesktopLyric.Designer.cs
?????文件???????5817??2014-11-30?18:12??LyricShow\LyricShow\frmDesktopLyric.resx
?????文件???????6115??2014-11-30?18:12??LyricShow\LyricShow\Lyric.cs
?????文件??????22978??2014-12-01?15:19??LyricShow\LyricShow\LyricShow.cs
?????文件???????2713??2014-11-30?14:46??LyricShow\LyricShow\LyricShow.csproj
?????文件????????168??2010-07-20?11:17??LyricShow\LyricShow\LyricShow.csproj.user
?????文件???????1511??2010-07-20?11:17??LyricShow\LyricShow\obj\Debug\LyricShow.csproj.FileListAbsolute.txt
?????文件????????779??2015-03-27?00:05??LyricShow\LyricShow\obj\Debug\LyricShow.csproj.GenerateResource.Cache
?????文件??????22528??2015-03-27?00:05??LyricShow\LyricShow\obj\Debug\LyricShow.dll
?????文件????????180??2015-03-27?00:05??LyricShow\LyricShow\obj\Debug\LyricShow.frmDesktopLyric.resources
?????文件??????42496??2015-03-27?00:05??LyricShow\LyricShow\obj\Debug\LyricShow.pdb
?????文件???????8192??2014-12-01?15:12??LyricShow\LyricShow\obj\Debug\Refactor\LyricShow.dll
?????文件???????1509??2015-03-27?00:06??LyricShow\LyricShow\obj\LyricShow.csproj.FileListAbsolute.txt
?????文件???????1362??2010-07-20?09:38??LyricShow\LyricShow\Properties\AssemblyInfo.cs
?????文件???????1409??2014-11-30?14:46??LyricShow\LyricShow.sln
????..A..H.?????30720??2017-09-09?11:43??LyricShow\LyricShow.suo
?????文件??????53248??2015-03-27?00:05??LyricShow\LyricShowTest\bin\Debug\AxInterop.WMPLib.dll
?????文件?????290816??2015-03-27?00:05??LyricShow\LyricShowTest\bin\Debug\Interop.WMPLib.dll
?????文件??????22528??2015-03-27?00:05??LyricShow\LyricShowTest\bin\Debug\LyricShow.dll
?????文件??????42496??2015-03-27?00:05??LyricShow\LyricShowTest\bin\Debug\LyricShow.pdb
?????文件??????11264??2015-03-27?00:05??LyricShow\LyricShowTest\bin\Debug\LyricShowTest.exe
?????文件??????22016??2015-03-27?00:05??LyricShow\LyricShowTest\bin\Debug\LyricShowTest.pdb
?????文件???????5632??2017-09-09?11:24??LyricShow\LyricShowTest\bin\Debug\LyricShowTest.vshost.exe
?????文件???????1594??2014-12-01?14:38??LyricShow\LyricShowTest\Form1.cs
?????文件???????6971??2014-12-01?14:45??LyricShow\LyricShowTest\Form1.Designer.cs
?????文件???????6704??2014-11-30?15:33??LyricShow\LyricShowTest\Form1.resx
?????文件???????4250??2014-11-30?14:46??LyricShow\LyricShowTest\LyricShowTest.csproj
............此處省略39個文件信息
評論
共有 條評論