海信家电”换帅 “ 高玉玲接替代慧忠出任新任董事长
2024-11-22
procedure TForm1.FormPaint(Sender: TObject); var x: Integer; y,a: Double; begin Canvas.Pen.Width:=3; Canvas.MoveTo(0,Trunc(self.ClientHeight/2)); for x := 0 to self.ClientWidth do begin a := (x/self.ClientWidth) * 2 * Pi; y := Sin(a); y := (1-y)*self.ClientHeight/2; Canvas.LineTo(Trunc(x), Trunc(y)); end; end; |
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) procedure FormPaint(Sender: TObject); procedure FormResize(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormPaint(Sender: TObject); var x: Integer; y,a: Double; begin Canvas.Pen.Width:=3; Canvas.MoveTo(0,Trunc(self.ClientHeight/2)); for x := 0 to self.ClientWidth do begin a := (x/self.ClientWidth) * 2 * Pi; y := Sin(a); y := (1-y)*self.ClientHeight/2; Canvas.LineTo(Trunc(x), Trunc(y)); end; end; procedure TForm1.FormResize(Sender: TObject); begin Refresh; end; procedure TForm1.FormCreate(Sender: TObject); begin self.DoubleBuffered:=true; //防止图形闪烁 end; end. |
图1 程序运行结果 |
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交