## 绘制正弦曲线和余弦曲线 转

涂孟超

``````unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
procedure FormClick(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{\$R *.dfm}

const
BoolArr: array[Boolean] of string = ('余弦曲线', '正弦曲线');
var
f: Boolean = True;

procedure TForm1.FormClick(Sender: TObject);
begin
f := not f;
Repaint;
end;

procedure TForm1.FormPaint(Sender: TObject);
var
x: Integer;
begin
Canvas.Pen.Width := 2;
Canvas.Pen.Color := clRed;
Canvas.MoveTo(0, ClientWidth div 2);
for x := 0 to ClientWidth do
begin
radian := x / ClientWidth * 4 * pi;
y := (1-y) * ClientHeight / 2;
Canvas.LineTo(Round(x), Round(y));
end;
Text := BoolArr[f];
end;

end.

``````

### 涂孟超

Delphi实现正弦曲线的绘制

isolated
2011/05/14
58
0
Android自定义View——实现水波纹效果类似剩余流量球

a_zhon
2017/09/04
0
0

2017/11/27
0
0

demonQ
02/15
0
0
ABAP开发基础知识：8)数值运算及算术运算函数

ken_ngai
2012/03/28
0
0

23分钟前
11
0

47分钟前
19
0

55分钟前
28
0
Elasticsearch 实战(一) - 简介

JavaEdge
59分钟前
23
0
【jQuery基础学习】11 jQuery性能简单优化

18
0