知道delphi 4的复活节彩旦吗?(0分)

  • 主题发起人 主题发起人 www
  • 开始时间 开始时间
W

www

Unregistered / Unconfirmed
GUEST, unregistred user!
知道delphi 4的复活节彩旦吗?在about中试试:
[Alt] + D E V E L O P E R S
[Alt] + Q U A L I T Y
[Alt] + T E A M (dedicated to Jan W. Kraski)
最有趣的是这个:[Alt] + C H U C K
 
borland不学好,搞这些花架子.:-/
 
D5中它又学好了.
上述彩蛋不全有. 那个"最有趣的"就没有.
 
彩旦大家看过了,我的问题来了,谁有象彩旦中的动画文本控件??
一点闪烁都没有,我做的就闪得厉害.
 
保留点幽默感也不错么,
我也喜欢这么干,可惜没人看!
 
不要用LABEL,应该自己TEXTOUT
 
to cAkk:
该怎么做?
 
Textout不是有坐标的参数吗? 每次把y坐标-1就可以了.
我没做过,凭空想象的.:-)
 
最好能贴出代码来
 
说的够清楚的了... :-(
canvas.textout(x,y,string);
在timer里面每次把y的值减一,重新textout就可以了.
 
to cAkk:
这样是闪的!请看我的这段代码:
运行时如果字体大了闪的厉害.
unit AnimateText;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;const defaulttext='SrwAnimateText Version 1.0';
type atAmtType=(atUptoDown,atDowntoUp,atLefttoRight,atRighttoLeft);type
TAnimateText = class(Tgraphiccontrol) private
charwidth,charheight:integer;
charnum,rows:integer;
//每行的字数及需要的行数
atTime:TTimer;
begin
x:integer;
FAnimateType:atAmtType;
FText:String;
FInterval:integer;
FActive:boolean;
FStep:integer;
procedure SetText(value:String);
procedure setInterval(value:integer);
procedure setActive(value:boolean);
procedure setstep(value:integer);
procedure setAnimateType(value:atAmtType);
procedure Animated;
procedure Textanimated(sender:TObject);
protected
procedure Paint;override;
public
constructor Create(AOwner:TComponent);override;
destructor Destroy;override;
published
property Active:boolean read FActive write SetActive;
property Text:string read Ftext write SetText;
property Interval:integer read Finterval write SetInterval default 100;
property Step:integer read FStep write setStep default 5;
property AnimateType:atAmtType read FAnimateType write setanimateType;
property Font;
property Color;
property Align;
property Enabled;
property Hint;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
procedure Register;implementation
Constructor TAnimateText.Create(AOwner:TComponent);
begin
inherited Create(AOwner);
atTime:=TTimer.Create(self);
atTime.Enabled:=false;
atTime.OnTimer:=TextAnimated;
begin
x:=0;
SetText(defaultText);
Setinterval(200);
SetStep(2);
end;
procedure TAnimateText.Paint;var temp:integer;
begin
canvas.font:=font;
charwidth:=canvas.TextWidth('aaaaaaaaaa') div 10;
charheight:=canvas.TextHeight('jjjjjjjjjj')+1;
charnum:=(width-4) div charwidth;
//每行的字数
rows:=Length(Ftext) div charnum+1;
//需要多少行 if FActive then
begin
Animated;
exit;
end;
setbkmode(canvas.handle,transparent);
//透明的
for temp:=1 to rowsdo
begin
canvas.TextOut(2,2+(temp-1)*charheight,copy(FText,charnum*(temp-1)+1,charnum));
end;
end;
procedure TAnimateText.setstep(value:integer);
begin
if value<>FStep then
begin
FStep:=value;
invalidate;
end;
end;
procedure TAnimateText.SetText(value:string);
begin
if value<>FText then
begin
FText:=value;
invalidate;
end;
end;
procedure TAnimateText.setAnimateType(value:atAmtType);
begin
if value<>FAnimateType then
begin
FAnimateType:=value;
invalidate;
end;
end;
procedure TAnimateText.setInterval(value:integer);
begin
if value<>FInterval then
begin
FInterval:=value;
atTime.Interval:=FInterval;
end;
end;
procedure TAnimateText.setActive(value:boolean);
begin
if FActive<>value then
begin
FActive:=value;
atTime.Enabled:=FActive;
invalidate;
end;
end;
procedure TAnimateText.Animated;var temp:integer;
begin
case FAnimateType of atUptoDown:begin
begin
x:=begin
x+FStep;
if begin
x>height then
begin
x:=0-rows*charheight;
setbkmode(canvas.handle,transparent);
canvas.pen.Color:=font.Color;
for temp:=1 to rowsdo
begin
canvas.TextOut(2,begin
x+(temp-1)*charheight,copy(FText,charnum*(temp-1)+1,charnum));
end;
end;
atDowntoUp:begin
begin
x:=begin
x-FStep;
if begin
x<0-rows*charheight then
begin
x:=height;
setbkmode(canvas.handle,transparent);
//透明的
for temp:=1 to rowsdo
begin
canvas.TextOut(2,begin
x+(temp-1)*charheight,copy(FText,charnum*(temp-1)+1,charnum));
end;
end;
atRighttoLeft:begin
begin
x:=begin
x-FStep;
if begin
x<0-width then
begin
x:=width;
setbkmode(canvas.handle,transparent);
//透明的
for temp:=1 to rowsdo
begin
canvas.TextOut(begin
x,2+(temp-1)*charheight,copy(FText,charnum*(temp-1)+1,charnum));
end;
end;
atLefttoRight:begin
begin
x:=begin
x+FStep;
if begin
x>width then
begin
x:=0-width;
setbkmode(canvas.handle,transparent);
//透明的
for temp:=1 to rowsdo
begin
canvas.TextOut(begin
x,2+(temp-1)*charheight,copy(FText,charnum*(temp-1)+1,charnum));
end;
end;
end;
{case}end;
procedure TAnimateText.Textanimated(sender:TObject);
begin
if atTime.Enabled then
invalidate;
end;
destructor TAnimateText.Destroy;
begin
inherited Destroy;// tempbmp.free;
end;
procedure Register;
begin
RegisterComponents('SrwSoft', [TAnimateText]);
end;
end.
 
用双缓冲不就不闪了吗?,再弄一个TImage,先往Timage.Canvas上写,全写完了然
后再往TGraphicControl.Canvas上copy.
 
>>>setbkmode(canvas.handle,transparent);

透明的可能是要闪烁,不过borland里面的那个不是透明的.
 
透明的应该用途广些,也好看许多。
 
我刚刚看了,好象是AVI之类的动画吧??
 
蚯蚓:不是AVI,你用spy++看看他的classnam就知道了.
关于透明,我的想法是:
在textout之前,先把即将显示text的背景区域copy下来,放在一个临时
bitmap里面,然后textout到这个临时bitmap上,然后再draw这个
bitmap到背景上,这样肯定没有闪烁.
 

Similar threads

后退
顶部