- Siapkan alat tulis seperti pensil warna hijau tinta hitam (tergantung warna favorit)
- Sediakan kertas >> sepotong aja cukuplah yang penting gambarnya imut2
- Gambar kubusnya >> ingat kembali pelajaran kelas 5 SD
- Tentukan titik2 koordinatnya, misalnya (x1,y1) sampai (x8,y8) >> kubus memiliki 8 titik sudut
- Buat form baru, lalu klik 2x pada area kosongnya, lalu ketik listingnya:
- Buat 3 edit text masing2 untuk x1, y1, dan sisi
- Buat 1 button untuk prosesnya.
- Selamat mencoba!!!!
- Semoga bermanfaat.
- to be continue...
____________________________________________________________________________LISTING POIN 5procedure TForm1.FormCreate(Sender: TObject);beginForm1.Canvas.MoveTo(0,round(form1.Height/2));form1.Canvas.LineTo(form1.Width,round(form1.Height/2));form1.Canvas.MoveTo(round(form1.Width/2),0);form1.Canvas.LineTo(round(form1.Width/2),form1.Height);end;____________________________________________________________________________LISTING POIN 7
procedure TForm1.Button2Click(Sender: TObject);beginx0:=Form1.Width div 2;y0:=Form1.Height div 2;x1:=StrToInt(txtx1.Text);y1:=StrToInt(txty1.Text);sisi:=StrToInt(txtsisi.Text);x2:=x1;y2:=x1+sisi;x3:=x1+sisi;y3:=y2;x4:=x3;y4:=y1;x5:=x1+round(sisi/4);y5:=y1+round(sisi/4);x6:=x5+sisi;y6:=y5;x7:=x6;y7:=y6+sisi;x8:=x5;y8:=y7;with Form1 dobeginRefresh;Canvas.MoveTo(round(x1+x0),round(y0-y1));Canvas.LineTo(round(x2+x0),round(y0-y2));Canvas.MoveTo(round(x2+x0),round(y0-y2));Canvas.LineTo(round(x3+x0),round(y0-y3));Canvas.MoveTo(round(x3+x0),round(y0-y3));Canvas.LineTo(round(x4+x0),round(y0-y4));Canvas.MoveTo(round(x4+x0),round(y0-y4));Canvas.LineTo(round(x1+x0),round(y0-y1));Canvas.MoveTo(round(x1+x0),round(y0-y1));Canvas.LineTo(round(x5+x0),round(y0-y5));Canvas.MoveTo(round(x5+x0),round(y0-y5));Canvas.LineTo(round(x6+x0),round(y0-y6));Canvas.MoveTo(round(x6+x0),round(y0-y6));Canvas.LineTo(round(x4+x0),round(y0-y4));Canvas.MoveTo(round(x6+x0),round(y0-y6));Canvas.LineTo(round(x7+x0),round(y0-y7));Canvas.MoveTo(round(x7+x0),round(y0-y7));Canvas.LineTo(round(x3+x0),round(y0-y3));Canvas.MoveTo(round(x7+x0),round(y0-y7));Canvas.LineTo(round(x8+x0),round(y0-y8));Canvas.MoveTo(round(x8+x0),round(y0-y8));Canvas.LineTo(round(x5+x0),round(y0-y5));Canvas.MoveTo(round(x8+x0),round(y0-y8));Canvas.LineTo(round(x2+x0),round(y0-y2));end;end;
Rabu, 05 Desember 2012
Menggambar Kubus menggunakan Delphi 7
Berikut ini langkah-langkah menggambar kubus menggunakan Delphi.7.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar