Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Membuat Grafik 3D

10:46 Add Comment
Jika pada posisi perintah sebagaimana contoh ke-tiga dari rangkaian ini dipanggil: make_3Dbar_graph, maka akan diperoleh grafik batang 3D. prosedur ini memanfaatkan sebuah rangkaian titik sebagaimana membuat diagram garis. perhatikan, bahwa untuk ke titik lebih atas, y harus dikurang, dan saya menggunakan pengurang sebesar 2 satuan pixel. “bayang-bayang” gambar diletakkan di sebelah kanan.
Perhatikan prosedur untuk membuat gambar 3D berikut:

procedure make_3dbar_graph;
var k,x1,y1,x2,y2:integer;
begin
//w:= 4; //4 pixel
for k:= 1 to length(GraphPoints)-1 do
begin
x1:= GraphPoints[k].X-3;
x2:= GraphPoints[k].X+3;
y1:= GraphPoints[k].Y;
y2:= MostBottom;
cv.Rectangle(x1,y1,x2,y2) ;
//
cv.polyline([point(x1,y1),point(x1+2,y1-2),point(x2+2,y1-2),point(x2,y1)]);
cv.Polyline([point(x2,y1),point(x2+2,y1-2),point(x2+2,y2-2),point(x2,y2)]);
end;
end;

DRAG FILES KE FORM DELPHI

18:40 Add Comment
1.  unit Unit1;

2.  interface

3.  uses

4.    Windows, Messages, SysUtils, Classes,

5.    Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls, jpeg,

6.    OleCtrls, SHDocVw;

7.  type

8.    TForm1 = class(TForm)

9.      Image1: TImage;

10.      ListBox1: TListBox;

11.      WebBrowser1: TWebBrowser;

12.      procedure FormCreate(Sender: TObject);

13.    private

14.      { Private declarations }

15.    public

16.      { Public declarations }

17.      // mendeklarasikan procedure acceptfiles

18.      procedure AcceptFiles(var msg: TMessage);

19.        message WM_DROPFILES;

20.      end;

21.  var

22.    Form1: TForm1;

23.  implementation

24.  uses

25.    // menginclude shellapi ke program

26.    ShellAPI;

27.  {$R *.DFM}

28.  procedure TForm1.AcceptFiles(var msg: TMessage);

29.  const

30.    cnMaxFileNameLen = 255;

31.  var

32.    i,

33.      nCount: integer;

34.    acFileName: array[0..cnMaxFileNameLen] of char;

35.  begin

36.    // menghitung jumlah file yang di drag

37.    nCount := DragQueryFile(msg.WParam,

38.      $FFFFFFFF,

39.      acFileName,

40.      cnMaxFileNameLen);

41.    // pengulangan jumlah file yang di blok

42.    for i := 0 to nCount - 1 do

43.    begin

44.      DragQueryFile(msg.WParam, i,

45.        acFileName, cnMaxFileNameLen);

46.      // memasukan alamat file yang didrag ke listbox

47.      ListBox1.Items.Add(acFileName);

48.    end;

49.  //jika ingin menampilkan gambar gunakan

50.    //image1.Picture.LoadFromFile(acFileName);

51.  //jika ingin menampilkan web gunakan

52.    //WebBrowser1.Navigate(acFileName);

53.    DragFinish(msg.WParam);

54.  end;

55.  

56.  procedure TForm1.FormCreate(Sender: TObject);

57.  begin

58.    // mengijinkan file untuk di drag di form

59.    DragAcceptFiles(Handle, True);

60.  end;

61.  end.