如题,谢谢!
解决方案 »
- delphi 控件设计期属性无法应用到运行期
- 使用字符串数组会使EXE文件体积增大?
- 问几个简单的问题,如何在DBComboBox控件下拉列表中,动态列出某个字段的值?以及动态SQL输出参数的格式
- 如何让caption在标题栏上居中显示?
- 请教一个有关dbgrideh 的问题,我想了很久,都解决不了,请大家帮帮我吧!!!
- [06.18] . . . . . 请教如何直接写Variant数组的数据
- 谁能借用一个文件给我?qtintf.dll !!!急
- 三层中,如何知道数据已提交Applyupdate成功呢?
- 谁有DELFOREXP FOR D6,请发一个给我EMAIL
- 怎样得到treeview的“所有同一级”或“全部第一级”或“全部最低级”的值
- 一个有关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.