Лекция: Практическая работа № 27

«Олимпийский флаг»

Цель работы -создать программу, которая на поверхности формы рисует олимпийский флаг.

 
 

 


Листинг программы:

unitUnit1;

 

Interface

 

Uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs;

 

Type

TForm1 = class(TForm)

procedure FormPaint(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

Var

Form1: TForm1;

 

Implementation

 

{$R *.dfm}

 

procedure TForm1.FormPaint(Sender: TObject);

Begin

with Canvas do

Begin

// полотнище

Canvas.Pen.Width := 1;

Canvas.Pen.Color := clBlack;

Canvas.Brush.Color := clCream;

Rectangle(30,30,150,115);

 

// кольца

Pen.Width := 2;

Brush.Style := bsClear; // область внутри круга

// не закрашивать

Pen.Color := clBlue;

Ellipse(40,40,80,80);

Pen.Color := clBlack;

Ellipse(70,40,110,80);

Pen.Color := clRed;

Ellipse(100,40,140,80);

Pen.Color := clYellow;

Ellipse(55,65,95,105);

Pen.Color := clGreen;

Ellipse(85,65,125,105);

end;

end;

 

end.

 


еще рефераты
Еще работы по информатике