procedure TForm1.Button1Click(Sender:TObject);
var
pol: array[1..3] of TPoint; //uchburchak nuktalari koordinatasi
{TPointqrecord
X:longint;
Y:longint
End;}
{
Pol[1]->x=10;
Pol[1]->y=50;
Pol[1]->x=40;
Pol[1]->y=10;
Pol[1]->x=70;
Pol[1]->y=50;
Form1->Canvas->Polygon(pol);
};
Cеktor.
Ellips yoki aylana sеktorini hosil qilishda Pie uslubidan foydalaniladi. Pie ning umumiy yozilish formati:
Ob`еkt->Canvas->Pie(x1,y1,x2,y2,x3,y3,x4,y4)
bu yerda
ob`еkt – yoy chiziluvchi ob`еkt nomi;
x1,y1,x2,y2 – hosil bo`luvchi sеktorni davom ettirib hosil qilinuvchi ellips (aylana)ga tashqi chizilgan to`g`ri to`rtburchakning mos koordinatalari;
x3,y3 – sеktorning boshlang`ich nuqtasi;
x4,y4 – sеktorning tugash nuqtasi.
1.6-rasm.
Topshiriqlarni bajarish namunasi.
Topshiriq: Ekranning ixtiyoriy qismida paydo bo`layotgan nuqta tasvirini yarating.
2. Dasturi.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var i,j:integer;
a:array[1..600] of integer;
begin
for i:=1 to 600 do
begin
a[i]:=i;
end;
for i:=1 to 4000 do
begin
Form1.Canvas.Pen.Color:=clblue;
Form1.Canvas.Pen.Width:=10;
Form1.Canvas.Pixels[random(a[i]),random(a[i])-100] := clblue;
for j:=1 to 50000000 do
begin
end;
Form1->Canvas->Pixels[random(a[i]),random(a[i])] =clbtnface;
end;
end;
end.
|