MultiRec.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit MultiRec;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   StdCtrls, Mask, DBCtrls, DBTables, DB, ComCtrls, ExtCtrls, DBCGrids;
  6. type
  7.   TForm1 = class(TForm)
  8.     DBCtrlGrid1: TDBCtrlGrid;
  9.     Table1: TTable;
  10.     DataSource1: TDataSource;
  11.     Table1Name: TStringField;
  12.     Table1Capital: TStringField;
  13.     Table1Continent: TStringField;
  14.     Table1Area: TFloatField;
  15.     Table1Population: TFloatField;
  16.     DBEdit1: TDBEdit;
  17.     DBEdit2: TDBEdit;
  18.     Label1: TLabel;
  19.     Label2: TLabel;
  20.     Panel1: TPanel;
  21.     TrackBar1: TTrackBar;
  22.     LabelCols: TLabel;
  23.     procedure TrackBar1Change(Sender: TObject);
  24.     procedure FormResize(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.   end;
  30. var
  31.   Form1: TForm1;
  32. implementation
  33. {$R *.DFM}
  34. procedure TForm1.TrackBar1Change(Sender: TObject);
  35. begin
  36.   LabelCols.Caption := Format (
  37.     '%d Columns', [TrackBar1.Position]);
  38.   DBCtrlGrid1.ColCount := TrackBar1.Position;
  39.   DBCtrlGrid1.Width := ClientWidth;
  40. end;
  41. procedure TForm1.FormResize(Sender: TObject);
  42. begin
  43.   DBCtrlGrid1.RowCount :=
  44.     (ClientHeight - Panel1.Height) div 100;
  45.   DBCtrlGrid1.Height := ClientHeight - Panel1.Height;
  46.   DBCtrlGrid1.Width := ClientWidth;
  47. end;
  48. end.