如何制作卡拉OK效果的文字 [英] How to Make Karaoke Effect For text

查看:77
本文介绍了如何制作卡拉OK效果的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

制作文字效果(卡拉OK效果)simalar此视频

新年快乐

Make text effect (Karaoke effect) simalar this video
Happy new year

推荐答案

让我 Google [ ^ ]适合你!


也许这对你有所帮助:





Maybe this will be helpfull for you:


using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace KaraokeEditor
{
    public class KaraokeDrawer
    {
        PictureBox _pBox;
        public KaraokeDrawer(PictureBox pBox)
        {
            _pBox = pBox;
            _pBox.Paint += pictureBox1_Paint;
            _timer.Tick += Timer_Tick;
            _timer.Start();
        }

        Timer _timer = new Timer() {Enabled = true, Interval = 50};
        
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            string text = "Hello World!";
            var path = new GraphicsPath();
            path.AddString(text, new FontFamily("Arial"), (int)FontStyle.Regular, 50, new Point(10, 10), StringFormat.GenericDefault);
            e.Graphics.FillPath(new SolidBrush(Color.White), path);

            Region r = new Region(path);
            RectangleF rect = r.GetBounds(e.Graphics);
            RectangleF intersectRect = new RectangleF(rect.X, rect.Y, rect.Width * _percent / 100, rect.Height);
            r.Intersect(intersectRect);
            e.Graphics.FillRegion(Brushes.Red, r);

            e.Graphics.DrawPath(new Pen(Color.Blue), path);
        }
        

        int _percent = 0;
        private void Timer_Tick(object sender, EventArgs e)
        {
            ++_percent;
            _pBox.Invalidate();
            if (_percent >= 100)
            {
                _timer.Stop();
            }

        }
    }
}


这篇关于如何制作卡拉OK效果的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆