如题,谢谢!
解决方案 »
- delphi中如何实现像Windows开机时的那种滚动的进度条
- PB9.0开发的大中型连锁超市POS系统源程序出售
- 谁做过云台的控制程序
- 程序打包
- c/s数据库程序中的一个小功能:将文件传至服务器指定的目录,高分求源码
- 拿到工资单的日子,竟是最难受的日子!
- 又急:当客户选中dbcombobox中某一个item时,要使他的选中无效,dbcombobox的text不变,怎么办?
- 有掌握ComPort控件的接收的大虾请来报名,我再开贴提问!
- TPersistentClass类与Class类有何区别?
- 如何修改打印机中默认的纸张大小
- 一个有关Socket的问题(delphi5->delphi7的)
- 请教关于"ShellExcute"这个API函数的使用实例
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
y, t, h : real ;
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
With Form1.Canvas do begin
//画坐标横轴
PenPos := Point(10,240);
LineTo(600,240);
PenPos := Point(594,238);
LineTo(600,240);
PenPos := Point(594,242);
LineTo(600,240);
//画坐标纵轴
PenPos := Point(10,400);
LineTo(10,80);
PenPos := Point(8,86);
LineTo(10,80);
PenPos := Point(12,86);
LineTo(10,80);
//将Pen移至坐标原点
PenPos := Point(10,240);
end; //初始化
h := 80;
t := 0; //开始画
Timer1.Enabled := True ;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
t := t + 1;
y := h * sin(t/180*3.14159);
Form1.Canvas.LineTo(Round(10+t),Round(240+y));
if round(t) = 598 then Timer1.Enabled := False;
end;end.
1、y,h,t 在Public中或private中定义
2、坐标原点为(10,240)
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
y, t, h : real ;
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
i : integer ;
begin
With Form1.Canvas do begin
//画坐标横轴
PenPos := Point(10,240);
LineTo(600,240);
PenPos := Point(594,238);
LineTo(600,240);
PenPos := Point(594,242);
LineTo(600,240);
//画坐标纵轴
PenPos := Point(10,400);
LineTo(10,80);
PenPos := Point(8,86);
LineTo(10,80);
PenPos := Point(12,86);
LineTo(10,80);
//将Pen移至坐标原点
PenPos := Point(10,240);
end; //初始化
h := 80;
t := 0;
Form1.Canvas.Pen.Mode := pmXOR ;
Form1.Canvas.Pen.Color := clRed ; //开始画
for i := 1 to 598 do begin
y := h * sin((t+i)/180*3.14159);
Form1.Canvas.LineTo(Round(10+i),Round(240+y));
end;
Timer1.Enabled := True ;
end;procedure TForm1.Timer1Timer(Sender: TObject);
var i: integer ;
begin
//擦除原线
y := h * sin((t+i)/180*3.14159);
Form1.Canvas.PenPos := Point(10,Round(240+y));
for i := 1 to 598 do begin
y := h * sin((t+i)/180*3.14159);
Form1.Canvas.LineTo(Round(10+i),Round(240+y));
end; //画相移后的线
t := t + 1;
y := h * sin((t+i)/180*3.14159);
Form1.Canvas.PenPos := Point(10,Round(240+y));
for i := 1 to 598 do begin
y := h * sin((t+i)/180*3.14159);
Form1.Canvas.LineTo(Round(10+i),Round(240+y));
end;
end;end.