Технология баз данных ADO в Delphi — страница 13

  • Просмотров 39450
  • Скачиваний 597
  • Размер файла 122
    Кб

самостоятельно 2.3. Код электронного учебника unit MainUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, XPMan, ComCtrls, DB, ADODB, Grids, DBGrids, ToolWin, jpeg; type TMainForm = class(TForm) Label1: TLabel; Label2: TLabel; Panel1: TPanel; RightBtn: TButton; Timer1: TTimer; Panel2: TPanel; LeftBtn: TButton; BottomBtn: TButton; XPManifest1: TXPManifest; Panel3: TPanel; Panel4: TPanel; Label3: TLabel; Memo1: TMemo; LeftRetBtn: TButton; Label4: TLabel; Memo2: TMemo; RightRetBtn: TButton; Label5: TLabel; TopRetBtn: TButton; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Memo3: TMemo; DBGrid1: TDBGrid; ADOConnection1: TADOConnection; DataSource1:

TDataSource; ADOTable1: TADOTable; TabControl1: TTabControl; Panel5: TPanel; ADOCommand1: TADOCommand; Memo4: TMemo; Label10: TLabel; Button1: TButton; ADOQuery1: TADOQuery; Button2: TButton; Image1: TImage; procedure RightBtnClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure LeftBtnClick(Sender: TObject); procedure BottomBtnClick(Sender: TObject); procedure LeftRetBtnClick(Sender: TObject); procedure RightRetBtnClick(Sender: TObject); procedure TopRetBtnClick(Sender: TObject); procedure TabControl1Change(Sender: TObject); procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var MainForm:

TMainForm; implementation {$R *.dfm} procedure TMainForm.RightBtnClick(Sender: TObject); var i: integer; begin if not Panel1.Visible then Exit; Panel1.Align := alNone; Panel2.Align := alNone; Panel2.Left := ClientWidth; Panel2.Visible := true; Panel2.Update; for i:=0 to ClientWidth div 5 do begin Panel1.Left := Panel1.Left - 5; Panel2.Left := Panel2.Left - 5; Update; end; Panel1.Visible := false; Panel1.Align := alClient; Panel2.Align := alClient; end; procedure TMainForm.FormCreate(Sender: TObject); var i: integer; begin Panel1.Align := alClient; Panel2.Align := alClient; Panel3.Align := alClient; Panel4.Align := alClient; Panel1.Visible := true; Panel2.Visible := false; Panel3.Visible := false; Panel4.Visible := false; RightBtn.Align := alRight; LeftBtn.Align := alLeft;

BottomBtn.Align := alBottom; LeftRetBtn.Align := alLeft; RightRetBtn.Align := alRight; Label5.Align := alNone; TopRetBtn.Align := alTop; Update; Label5.Align := alTop; Label6.Align := alLeft; Label7.Align := alRight; Label8.Align := alRight; Label9.Align := alLeft; Button1.Align := alTop; Button2.Align := alTop; TabControl1.OnChange(self); if FileExists('about.txt') then Memo2.Lines.LoadFromFile('about.txt') else Memo2.Text := Файл не найден; if FileExists('lessons.txt') then Memo1.Lines.LoadFromFile('lessons.txt') else Memo1.Text := Файл не найден; {for i:=1 to ADOTable1.FieldCount-1 do DBGrid1.Columns[i].Width := 100; } end; procedure TMainForm.LeftBtnClick(Sender: TObject); var i: integer; begin if not Panel1.Visible then Exit; Panel1.Align := alNone;

Panel3.Align := alNone; Panel3.Left := -ClientWidth; Panel3.Visible := true; Panel3.Update; for i:=0 to ClientWidth div 5 - 5 do begin Panel1.Left := Panel1.Left + 5; Panel3.Left := Panel3.Left + 5; Update; end; Panel1.Visible := false; Panel1.Align := alClient; Panel3.Align := alClient; end; procedure TMainForm.BottomBtnClick(Sender: TObject); var i: integer; begin if not Panel1.Visible then Exit; Panel1.Align := alNone; Panel4.Align := alNone; Panel4.Top := ClientHeight; Panel4.Visible := true; Panel4.Update; for i:=0 to ClientHeight div 5 do begin Panel1.Top := Panel1.Top - 5; Panel4.Top := Panel4.Top - 5; Update; end; Panel1.Visible := false; Panel1.Align := alClient; Panel4.Align := alClient; end; procedure TMainForm.LeftRetBtnClick(Sender: TObject); var i: integer; begin if

Panel1.Visible then Exit; Panel2.Align := alNone; Panel1.Align := alNone; Panel1.Left := -ClientWidth; Panel1.Visible := true; Panel1.Update; for i:=0 to ClientWidth div 5 do begin Panel2.Left := Panel2.Left + 5; Panel1.Left := Panel1.Left + 5; Update; end; Panel2.Visible := false; Panel2.Align := alClient; Panel1.Align := alClient; end; procedure TMainForm.RightRetBtnClick(Sender: TObject); var i: integer; begin if Panel1.Visible then Exit; Panel3.Align := alNone; Panel1.Align := alNone; Panel1.Left := ClientWidth; Panel1.Visible := true; Panel1.Update; for i:=0 to ClientWidth div 5 do begin Panel3.Left := Panel3.Left - 5; Panel1.Left := Panel1.Left - 5; Update; end; Panel3.Visible := false; Panel3.Align := alClient; Panel1.Align := alClient; end; procedure