0% found this document useful (0 votes)
55 views5 pages

Materi

The document contains procedures and code for drawing shapes and lines on an image canvas in response to button clicks. It uses loops, variables, and conditional logic to generate random coordinates and colors and draw circles, lines, and text on the image.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views5 pages

Materi

The document contains procedures and code for drawing shapes and lines on an image canvas in response to button clicks. It uses loops, variables, and conditional logic to generate random coordinates and colors and draw circles, lines, and text on the image.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

procedure TForm1.Button1Click(Sender: TObject); var x,y: integer; begin for x:= 0 to 200 do begin image1.Canvas.

pixels[10+x,10]:=clred; end; for y :=0 to 200 do begin image1.Canvas.pixels[10,10+y]:=clred; end; end; end. begin for z := 0 to 20 do begin for x:= 0 to image1.Width-1 do begin image1.Canvas.pixels[10+x,10+z*20]:=clred; end; for y :=0 to image1.height-1 do begin image1.Canvas.pixels[10+z*50,10+y]:=clred; end; end; end; procedure TForm1.Button2Click(Sender: TObject); var xr,yr,sudut :real ; ix,iy:integer; const jari_jari =50; begin sudut :=0; repeat xr := jari_jari *sin (2*pi*sudut/360); yr := jari_jari *cos (2*pi*sudut/360); sudut :=sudut + 5; image1.Canvas.MoveTo(100,100); image1.Canvas.lineto(100+round(xr),100+round(yr)); until sudut >360; end;

procedure TForm1.Button2Click(Sender: TObject); var xr,yr,sudut :real ; ix,iy,z:integer; const jari_jari =50; begin for z := 0 to 3 do begin sudut :=0; repeat xr := jari_jari *(sin (2*pi*sudut/360)+ 0.2*sin (2*pi*5*sudut/360)) ; yr := jari_jari *(cos (2*pi*sudut/360)+0.2*cos (2*pi*5*sudut/360)); sudut :=sudut + 5; image1.Canvas.pen.Color:=clblue; image1.Canvas.MoveTo(100 +z*75,100+z*75); image1.Canvas.lineto(100+round(xr)+z*75,100+round(yr)+z*75); until sudut >360; end; end; var xr,yr,sudut :real ; ix,iy,ranx,rany,ulang:integer; const jari_jari = 25; begin begin for ulang := 1 to 3 do sudut :=0; randomize; ranx := random(350); rany := random(350); repeat xr := jari_jari *(sin (2*pi*sudut/360)+ 0.2*sin (2*pi*5*sudut/360)) ; yr := jari_jari *(cos (2*pi*sudut/360)+0.2*cos (2*pi*5*sudut/360)); sudut :=sudut+2; image1.Canvas.pen.Color:=clred; image1.Canvas.MoveTo(100 +ranx,100+rany); image1.Canvas.lineto(100+round(xr)+ranx,100+round(yr)+rany); until sudut >360; end; end;

procedure TForm1.Button2Click(Sender: TObject); var xr,yr,sudut :real ; ix,iy,ranx,rany,ulang:integer; warna1,warna2,warna3,warna4:byte; bentuk,radius :byte; const jari_jari = 25; begin begin for ulang := 1 to 3 do sudut :=0; randomize; ranx := random(350); rany := random(350); warna1:=15+random(250); warna2:=15+random(250); warna3:=15+random(250); bentuk := 15+random(250); radius := 4+random(250); repeat xr := jari_jari-radius *(sin (1*pi*sudut/360)+ 0.2*sin (1*pi*15*sudut/360)) ; yr := jari_jari-radius *(cos (1*pi*sudut/360)+0.2*cos (1*pi*35*sudut/360)); sudut :=sudut+0.5; image1.Canvas.pen.Color:= rgb(warna1,warna2,warna3); image1.Canvas.MoveTo(100 +ranx,100+rany); image1.Canvas.lineto(100+round(xr)+ranx,100+round(yr)+rany); until sudut >360; end; end; var i1,i2 : integer; begin If Radiobutton1.Checked then label1.caption :='dicentang' else label1.caption :='tidak dicentang'; end; procedure TForm1.Button2Click(Sender: TObject); var hasil_tes, batas_nilai : integer ; membayar : integer; const teman_yang_lain = 500; begin hasil_tes:= strtoint(edit1.text); batas_nilai:= strtoint(edit2.text); membayar:= strtoint(edit3.text); if ((hasil_tes>batas_nilai) and (membayar>teman_yang_lain)) then

begin label1.caption :='menjadi mahasiswa um'; memo1.lines.clear; memo1.lines.add('selamat'); end else begin label1.caption :='tidak kuliah'; memo1.lines.clear; memo1.lines.add('maaf anda belum beruntung'); end; end; end. 1. Membuat string grid bisa diedit saat dijalankan Additionalstring grid di properties klik plus pada option trus klik go editing jadikan true Jangan lupa ganti enabled jadi true pada properties.. Kembali lagi ke string grid trus pada event (sebelahnya properties) pilih onkeydown Jumlah :

Kuadrat

Rata2

You might also like