昨天晚上玩玩kugou 感觉无聊!
用delphi 实现了kugou动感歌词 原来这么简单
我本着 开源的精神 希望大家来一起来吧
var
H1, H2, H3: HRGN;
s: string;
TextRect: TRect;
i: Integer;
begin
s := '这只是个测试而已!';
Canvas.Font.Size := 42;
Canvas.Font.Style := [fsBold];
Canvas.Font.Name := '黑体';
TextRect.Left := 0;
TextRect.Top := 0;
TextRect.Right := TextRect.Left + Canvas.TextWidth(s);
TextRect.Bottom := TextRect.Top + Canvas.TextHeight(s);
BeginPath(Canvas.Handle);
Canvas.TextOut(TextRect.Left, TextRect.Top, s);
EndPath(Canvas.Handle);
H1 := PathToRegion(Canvas.Handle);
H2 := CreateRectRgn(TextRect.Left, TextRect.Top, TextRect.Right, TextRect.Bottom);
H3 := CreateRectRgn(0, 0, 0, 0);
CombineRgn(H3, H1, H2, RGN_XOR);
SelectClipRgn(Canvas.Handle, H3);
Canvas.Brush.Color := clRed;
Canvas.FillRect(TextRect);
for i := TextRect.Left to TextRect.Right do
begin
//Canvas.Pen.Color := RGB(Round(256 * (i + 1) / TextRect.Right - TextRect.Left + 1), 100, 50);//不用随机颜色
sleep(10);
Canvas.Pen.Color := clGreen;
Canvas.MoveTo(i, TextRect.Top);
Canvas.LineTo(i, TextRect.Bottom);
end;
SelectClipRgn(Canvas.Handle, 0);
DeleteObject(H2);
DeleteObject(H3);
用delphi 实现了kugou动感歌词 原来这么简单
我本着 开源的精神 希望大家来一起来吧
var
H1, H2, H3: HRGN;
s: string;
TextRect: TRect;
i: Integer;
begin
s := '这只是个测试而已!';
Canvas.Font.Size := 42;
Canvas.Font.Style := [fsBold];
Canvas.Font.Name := '黑体';
TextRect.Left := 0;
TextRect.Top := 0;
TextRect.Right := TextRect.Left + Canvas.TextWidth(s);
TextRect.Bottom := TextRect.Top + Canvas.TextHeight(s);
BeginPath(Canvas.Handle);
Canvas.TextOut(TextRect.Left, TextRect.Top, s);
EndPath(Canvas.Handle);
H1 := PathToRegion(Canvas.Handle);
H2 := CreateRectRgn(TextRect.Left, TextRect.Top, TextRect.Right, TextRect.Bottom);
H3 := CreateRectRgn(0, 0, 0, 0);
CombineRgn(H3, H1, H2, RGN_XOR);
SelectClipRgn(Canvas.Handle, H3);
Canvas.Brush.Color := clRed;
Canvas.FillRect(TextRect);
for i := TextRect.Left to TextRect.Right do
begin
//Canvas.Pen.Color := RGB(Round(256 * (i + 1) / TextRect.Right - TextRect.Left + 1), 100, 50);//不用随机颜色
sleep(10);
Canvas.Pen.Color := clGreen;
Canvas.MoveTo(i, TextRect.Top);
Canvas.LineTo(i, TextRect.Bottom);
end;
SelectClipRgn(Canvas.Handle, 0);
DeleteObject(H2);
DeleteObject(H3);
解决方案 »
- 一个比较特殊的问题,关于Button组件的
- delphi中怎样获取当前记录,并更新当前记录后的所有记录
- 紧急求购~!!
- dbgrid的添加一个后缀字符的问题??
- 紧急求救 select sum(field1) as f1,sum(field2) as f2 from table1 问题~
- 急用————谁能提供李维的高效数据库程序设计中的示例数据库文件
- 数据变化时事件触发问题
- 100分求问dbgrid同列合并的问题,没那么简单?
- sql问题,急!!!!!!!
- 10进制怎么TO16进制...
- edit控件,怎样分别获取光标所在位置前面、后面的字符串
- 各位大神,webbrowser与idhttp的问题
这个真的很简单啊,LRC歌词本身有时间 Flag,解析出来就可以了