home *** CD-ROM | disk | FTP | other *** search
/ Chip: Shareware for Win 95 / Chip-Shareware-Win95.bin / ostatni / delphi / ruzne / auto32d3.exe / rar / AUTO32D3 / DEMOS / DELPHI3.0 / DRAWDBGR / MAIN.PAS < prev   
Pascal/Delphi Source File  |  1997-07-05  |  2KB  |  71 lines

  1. unit main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Grids, DBGrids, Buttons, StdCtrls, ExtCtrls, DB, DBTables,
  8.   afilter, AutoDB, adbgrid;
  9.  
  10. type
  11.   TMainForm = class(TForm)
  12.     DataSource1: TDataSource;
  13.     Panel1: TPanel;
  14.     Panel2: TPanel;
  15.     Button1: TButton;
  16.     BitBtn1: TBitBtn;
  17.     AutoDBGrid1: TAutoDBGrid;
  18.     Table1: TTable;
  19.     procedure Button1Click(Sender: TObject);
  20.     procedure AutoDBGrid1DrawFieldCellEvent(Sender: TObject; Field: TField;
  21.       var Color: TColor; var Font: TFont);
  22.   private
  23.     { Private declarations }
  24.   public
  25.     { Public declarations }
  26.   end;
  27.  
  28. var
  29.   MainForm: TMainForm;
  30.  
  31. implementation
  32.  
  33. uses About;
  34.  
  35.  
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TMainForm.Button1Click(Sender: TObject);
  40. begin
  41.   fmAboutBox.ShowModal;
  42. end;
  43.  
  44. procedure TMainForm.AutoDBGrid1DrawFieldCellEvent(Sender: TObject;
  45.   Field: TField; var Color: TColor; var Font: TFont);
  46. Var
  47.   p : Integer;
  48. begin
  49.   if(Field = Table1.FindField('population')) then begin
  50.     p := Table1.FindField('population').AsInteger;
  51.     if(p < 1000000) then begin
  52.       Color := clWhite;
  53.       Font.Style := [fsItalic];
  54.     end;
  55.     if(p >= 1000000) And (p < 50000000) then
  56.       Color := clSilver;
  57.     if(p >= 5000000) And (p < 10000000) then
  58.       Color := clGray;
  59.     if(p >= 5000000) And (p < 10000000) then
  60.       Color := clOlive;
  61.     if(p >= 10000000) And (p < 50000000) then
  62.       Color := clRed;
  63.     if(p > 50000000) then begin
  64.       Color := clMaroon;
  65.       Font.Style := [fsBold];
  66.     end;
  67.   end;
  68. end;
  69.  
  70. end.
  71.