Production of karaoke subtitles and karaoke subtitles

Source: Internet
Author: User

Production of karaoke subtitles and karaoke subtitles

Just implement the subtitle Effect of karaoke

* The color of a word changes linearly, that is, the color changes over time rather than by the unit of words.

So sometimes it is a part of the word to change the color

The main code is as follows:

Graphics g = pea. Graphics;
String str = "the signal is too large to be used in our village! ";

Pen myPen = new Pen (Color. Red );
SolidBrush backBr = new SolidBrush (Color. Blue );
Font font = new Font ("ms ui Gothic", 40 );

G. DrawString (str, font, backBr, new Point (10, 10); // background (blue)

SizeF size = g. MeasureString (str, font); // you can use the following picture to describe the short-cut character.

SolidBrush foreBr = new SolidBrush (Color. Red); // foreground text Color (red)
RectangleF rectF = new RectangleF (10, 10, 10, size. Height); // forground text

StringFormat strFmt = new StringFormat ();
StrFmt. FormatFlags = StringFormatFlags. NoWrap; // The returned value is "no ".
StrFmt. Trimming = StringTrimming. None; // The partition is not deleted.

For (int w = 1; w <= size. Width; w + = 1)
{
RectF. Width = w;

Try {
// G. DrawRectangle (Pens. Blue, rectF. Left, rectF. Top, rectF. Right, rectF. Bottom );
G. DrawString (str, font, foreBr, rectF, strFmt); // foreground

Thread. Sleep (5); // speed tuning (Dynamic tuning)
Application. DoEvents ();
} Catch (Exception e)
{
Return;
} // End try
} // End

Adjust Sleep () according to the speed of the specific lyrics. This section can be used to write a class and enter the lyrics to be displayed, speed, and other information. This class draws the lyrics on the CDC.

For reference only

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.