• 大小: 325KB
    文件类型: .zip
    金币: 2
    下载: 2 次
    发布日期: 2021-09-06
  • 语言: C#
  • 标签: 歌词显示  

资源简介

基于C#语言开发的歌词显示... 和KUGOU 类似噢 。。。

资源截图

代码片段和文件信息

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

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-03-05 13:10  LyricShow\
     目录           0  2011-03-05 13:10  LyricShow\LyricShow\
     文件        1410  2010-07-20 10:42  LyricShow\LyricShow.sln
     文件       26112  2011-01-10 19:16  LyricShow\LyricShow.suo
     目录           0  2011-03-05 13:10  LyricShow\LyricShowTest\
     目录           0  2011-03-05 13:10  LyricShow\LyricShowTest\bin\
     目录           0  2011-03-05 13:10  LyricShow\LyricShowTest\bin\Debug\
     文件       61440  2010-07-20 10:43  LyricShow\LyricShowTest\bin\Debug\AxInterop.WMPLib.dll
     文件      339968  2010-07-20 10:43  LyricShow\LyricShowTest\bin\Debug\Interop.WMPLib.dll
     文件       21504  2010-07-20 11:17  LyricShow\LyricShowTest\bin\Debug\LyricShow.dll
     文件       46592  2010-07-20 11:17  LyricShow\LyricShowTest\bin\Debug\LyricShow.pdb
     文件       11776  2010-07-20 11:19  LyricShow\LyricShowTest\bin\Debug\LyricShowTest.exe
     文件       26112  2010-07-20 11:19  LyricShow\LyricShowTest\bin\Debug\LyricShowTest.pdb
     文件       14328  2011-01-10 19:12  LyricShow\LyricShowTest\bin\Debug\LyricShowTest.vshost.exe
     文件         490  2007-07-21 01:33  LyricShow\LyricShowTest\bin\Debug\LyricShowTest.vshost.exe.manifest
     文件        1594  2010-07-20 11:19  LyricShow\LyricShowTest\Form1.cs
     文件        6971  2010-07-20 11:19  LyricShow\LyricShowTest\Form1.Designer.cs
     文件        6704  2010-07-20 11:19  LyricShow\LyricShowTest\Form1.resx
     文件        4271  2010-07-20 10:49  LyricShow\LyricShowTest\LyricShowTest.csproj
     目录           0  2011-03-05 13:10  LyricShow\LyricShowTest\obj\
     目录           0  2011-03-05 13:10  LyricShow\LyricShowTest\obj\Debug\
     文件       61440  2010-07-20 10:43  LyricShow\LyricShowTest\obj\Debug\AxInterop.WMPLib.dll
     文件      274432  2011-01-10 15:48  LyricShow\LyricShowTest\obj\Debug\Interop.WMPLib.dll
     文件        2235  2011-01-10 19:12  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.csproj.FileListAbsolute.txt
     文件         847  2010-07-20 11:19  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.csproj.GenerateResource.Cache
     文件         634  2011-01-10 15:48  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.csproj.ResolveComReference.cache
     文件       11776  2010-07-20 11:19  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.exe
     文件         737  2010-07-20 11:19  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.Form1.resources
     文件       26112  2010-07-20 11:19  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.pdb
     文件         180  2010-07-20 11:17  LyricShow\LyricShowTest\obj\Debug\LyricShowTest.Properties.Resources.resources
     文件        5154  2010-07-20 11:17  LyricShow\LyricShowTest\obj\Debug\ResolveAssemblyReference.cache
............此处省略32个文件信息

评论

共有 条评论