Y
yuyushuixing
Unregistered / Unconfirmed
GUEST, unregistred user!
系统总提示错误:是
undeclared identifier:'yearof'
undeclared identifier:'monthof'
undeclared identifier:'dayof'
谢谢帮忙了!!!!!!!!!!!!!!!
程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls; //ExtCtrls,extctrls,stdctrls,mplayer;
type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
StaticText1: TStaticText;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
txtstartpos,bmpstartpos:integer;//文字和图象的初始位置
l,h:integer;// 第二行文字的宽度和高度
pic:trect; // 画图象的矩形区域
map:tbitmap;// 图象
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//uses dateuntils,mmsystem;
procedure TForm1.Timer1Timer(Sender: TObject);
var length:integer;
begin
txtstartpos:=txtstartpos-1;
bmpstartpos:=bmpstartpos-1;
if txtstartpos<-image1.Height then //如果图象向上滚动超出屏幕区域,则底部从新开始
txtstartpos:=image1.Height;
bmpstartpos:=txtstartpos+80;
//将文字在屏幕中央位置输出
length:=image1.Canvas.TextWidth('欢迎使用!');
length:=(image1.Width-length) div 4;
image1.Canvas.Font.Size:=32;
image1.Canvas.Font.Color:=clgreen;
image1.Canvas.TextOut(length,txtstartpos,'欢迎使用');
image1.Canvas.Font.Size:=20;
image1.Canvas.Font.Color:=clblack;//黑体字输出
image1.Canvas.TextOut(length,txtstartpos+50,'Welcome to mysystem');
//计算字幕的高度和宽度
l:=image1.Canvas.TextWidth('Welcome to mysystem');
h:=image1.Canvas.TextHeight('Welcome to mysystem');
//清除前一次输出的字幕
image1.Canvas.Pen.Color:=clred;
image1.Canvas.MoveTo(40,h+txtstartpos+50-2);
image1.Canvas.LineTo(40+l,h+txtstartpos+50-2);
//定义图象的画出区域
length:=(image1.Width-map.Width) div 2;
pic.TopLeft.X:=length;
pic.TopLeft.Y:=bmpstartpos+5;
pic.BottomRight.X:=pic.TopLeft.X+map.Width;
pic.BottomRight.y:=pic.TopLeft.y+map.Height;
//输入图象
image1.Canvas.StretchDraw(pic,map);
image1.Canvas.MoveTo(0,pic.TopLeft.Y+map.Height);
image1.Canvas.LineTo(pic.TopLeft.X+map.Width,pic.TopLeft.Y+map.Height);
//显示拆解的当前日期
self.StaticText1.Caption:=inttostr(yearof(date))+'年'+inttostr(monthof(date))+'月'+inttostr(dayof(date))+'日';
//显示时间
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Enabled:=true;
timer1.Interval:=10; //频率为0.01秒
txtstartpos:=image1.Height; // 文字从窗口底部开始移动
bmpstartpos:=txtstartpos+20;
image1.Canvas.Brush.Color:=clred; // image1的背景颜色为红色
pic:=rect(0,0,image1.Width,image1.Height);
image1.Canvas.FillRect(pic); // 将image1画成红色的矩形框
pic:=rect(-1,-1,1,1); // 画图象的矩形区域
//初始化加载图象
map:=tbitmap.Create;
map.LoadFromFile('f:/picture/p6.jpg');
image1.Canvas.StretchDraw(pic,map);
// 重画窗口
form1.Repaint;
end;
end.
undeclared identifier:'yearof'
undeclared identifier:'monthof'
undeclared identifier:'dayof'
谢谢帮忙了!!!!!!!!!!!!!!!
程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls; //ExtCtrls,extctrls,stdctrls,mplayer;
type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
StaticText1: TStaticText;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
txtstartpos,bmpstartpos:integer;//文字和图象的初始位置
l,h:integer;// 第二行文字的宽度和高度
pic:trect; // 画图象的矩形区域
map:tbitmap;// 图象
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//uses dateuntils,mmsystem;
procedure TForm1.Timer1Timer(Sender: TObject);
var length:integer;
begin
txtstartpos:=txtstartpos-1;
bmpstartpos:=bmpstartpos-1;
if txtstartpos<-image1.Height then //如果图象向上滚动超出屏幕区域,则底部从新开始
txtstartpos:=image1.Height;
bmpstartpos:=txtstartpos+80;
//将文字在屏幕中央位置输出
length:=image1.Canvas.TextWidth('欢迎使用!');
length:=(image1.Width-length) div 4;
image1.Canvas.Font.Size:=32;
image1.Canvas.Font.Color:=clgreen;
image1.Canvas.TextOut(length,txtstartpos,'欢迎使用');
image1.Canvas.Font.Size:=20;
image1.Canvas.Font.Color:=clblack;//黑体字输出
image1.Canvas.TextOut(length,txtstartpos+50,'Welcome to mysystem');
//计算字幕的高度和宽度
l:=image1.Canvas.TextWidth('Welcome to mysystem');
h:=image1.Canvas.TextHeight('Welcome to mysystem');
//清除前一次输出的字幕
image1.Canvas.Pen.Color:=clred;
image1.Canvas.MoveTo(40,h+txtstartpos+50-2);
image1.Canvas.LineTo(40+l,h+txtstartpos+50-2);
//定义图象的画出区域
length:=(image1.Width-map.Width) div 2;
pic.TopLeft.X:=length;
pic.TopLeft.Y:=bmpstartpos+5;
pic.BottomRight.X:=pic.TopLeft.X+map.Width;
pic.BottomRight.y:=pic.TopLeft.y+map.Height;
//输入图象
image1.Canvas.StretchDraw(pic,map);
image1.Canvas.MoveTo(0,pic.TopLeft.Y+map.Height);
image1.Canvas.LineTo(pic.TopLeft.X+map.Width,pic.TopLeft.Y+map.Height);
//显示拆解的当前日期
self.StaticText1.Caption:=inttostr(yearof(date))+'年'+inttostr(monthof(date))+'月'+inttostr(dayof(date))+'日';
//显示时间
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.Enabled:=true;
timer1.Interval:=10; //频率为0.01秒
txtstartpos:=image1.Height; // 文字从窗口底部开始移动
bmpstartpos:=txtstartpos+20;
image1.Canvas.Brush.Color:=clred; // image1的背景颜色为红色
pic:=rect(0,0,image1.Width,image1.Height);
image1.Canvas.FillRect(pic); // 将image1画成红色的矩形框
pic:=rect(-1,-1,1,1); // 画图象的矩形区域
//初始化加载图象
map:=tbitmap.Create;
map.LoadFromFile('f:/picture/p6.jpg');
image1.Canvas.StretchDraw(pic,map);
// 重画窗口
form1.Repaint;
end;
end.