home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programming Unleashed / Delphi_Programming_Unleashed_SAMS_Publishing_1995.iso / chap09 / pixels / main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-03-21  |  895 b   |  46 lines

  1. unit Main;
  2.  
  3. { Program copyright (c) 1995 by Charles Calvert }
  4. { Project Name: PIXELS }
  5.  
  6. { This program shows how to draw the smallest
  7.   possible visual object to the screen, which
  8.   is a pixel. Also shows something about the
  9.   Windows coordinate system, and about using
  10.   the RGB function to access the colors available
  11.   on your system. }
  12.  
  13. interface
  14.  
  15. uses
  16.   WinTypes, WinProcs,
  17.   Classes, Graphics,
  18.   Controls, Printers, Forms;
  19.  
  20. type
  21.   TForm1 = class(TForm)
  22.     procedure FormPaint(Sender: TObject);
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. procedure TForm1.FormPaint(Sender: TObject);
  33. var
  34.   R: TRect;
  35.   i: Integer;
  36.   Color: LongInt;
  37. begin
  38.   R := GetClientRect;
  39.   for i := 1 to 10000 do begin
  40.     Color := RGB(Random(255), Random(255), Random(255));
  41.     Canvas.Pixels[Random(R.Right), Random(R.Bottom)] :=  Color;
  42.   end;
  43. end;
  44.  
  45. end.
  46.