Разработка программной системы «Автоматизированная записная книжка», страница 11

procedure BitBtn9Click(Sender: TObject);

procedure BitBtn10Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

q,w: integer;

implementation

{$R *.dfm}

uses Unit1, unit2,unit7, DB, Unit6;

procedure Tform3.FormActivate(Sender: TObject);

var i,j:integer;

begin

Form3.Left:=330;

Form3.Top:=112;

Edit1.Clear;

Edit2.Clear;

Edit3.Clear;

Edit4.Clear;

Edit5.Clear;

Memo1.Clear;

DataModule1.ADOQuery1.Close;

DataModule1.ADOQuery1.SQL.Clear;

DataModule1.ADOQuery1.SQL.Add('select distinct Gruppa from Contact');

DataModule1.ADOQuery1.Open;

DataModule1.ADOQuery1.First;

ComboBox1.Clear;

for j:=0 to DataModule1.ADOQuery1.RecordCount-1 do

begin

ComboBox1.Items.Add(DataModule1.ADOQuery1.Fields[0].AsString);

DataModule1.ADOQuery1.Next;end;

DataModule1.ADOQuery1.Close;

DataModule1.ADOQuery1.SQL.Clear;


DataModule1.ADOQuery1.SQL.Add('select FIO from Contact order by FIO');

DataModule1.ADOQuery1.Open;

{w:=DataModule1.ADOQuery1.RecordCount;}

DataModule1.ADOQuery1.First;

ListBox1.Clear;

for I:=0 to DataModule1.ADOQuery1.RecordCount-1 do

begin

ListBox1.Items.Add(DataModule1.ADOQuery1.Fields[0].AsString);

DataModule1.ADOQuery1.Next;end;

DataModule1.ADOQuery1.Close;

DataModule1.ADOQuery1.SQL.Clear;

DataModule1.ADOQuery1.SQL.Add('select ID_cont from Contact');

DataModule1.ADOQuery1.Open;

w:=DataModule1.ADOQuery1.RecordCount;end;

procedure TForm3.ListBox1Click(Sender: TObject);

begin

Edit1.Clear;

Edit2.Clear;

Edit3.Clear;

Memo1.Clear;

Edit4.Clear;

Edit5.Clear;

DataModule1.ADOQuery1.Close;

DataModule1.ADOQuery1.SQL.Clear;

DataModule1.ADOQuery1.SQL.Add('select ID_cont, FIO, tel, e_mail, Adress, Gruppa from Contact  where FIO='''+Listbox1.Items[Listbox1.ItemIndex]+''' ');

DataModule1.ADOQuery1.Open;

q:=DataModule1.ADOQuery1.Fields[0].AsInteger;

Edit5.Text:=inttostr(q);

Edit1.Text:=DataModule1.ADOQuery1.Fields[1].AsString;

Edit2.Text:=DataModule1.ADOQuery1.Fields[2].AsString;

Edit3.Text:=DataModule1.ADOQuery1.Fields[3].AsString;

Memo1.Text:=DataModule1.ADOQuery1.Fields[4].AsString;

Edit4.Text:=DataModule1.ADOQuery1.Fields[5].AsString;

BitBtn9.Visible:=false;

BitBtn10.Visible:=false;

GradientRect (clBlue, clBlack, Canvas);

Form3.Refresh;

Label1.Visible:=true;

Label2.Visible:=true;

Label3.Visible:=true;

Label4.Visible:=true;

Label5.Visible:=true;

Label6.Visible:=true;

Edit5.Visible:=true;end;

procedure TForm3.GradientRect (FromRGB, ToRGB: TColor; Canvas: TCanvas);

var

RGBFrom : array[0..2] of Byte; { from RGB values }

RGBDiff : array[0..2] of integer;

ColorBand : TRect; { color band rectangular coordinates }


I : Integer; { color band index }

R : Byte; { a color band's R value }

G : Byte; { a color band's G value }

B : Byte; { a color band's B value }

begin

RGBFrom[0] := GetRValue (ColorToRGB (FromRGB));

RGBFrom[1] := GetGValue (ColorToRGB (FromRGB));

RGBFrom[2] := GetBValue (ColorToRGB (FromRGB));

RGBDiff[0] := GetRValue (ColorToRGB (ToRGB)) - RGBFrom[0];

RGBDiff[1] := GetGValue (ColorToRGB (ToRGB)) - RGBFrom[1];

RGBDiff[2] := GetBValue (ColorToRGB (ToRGB)) - RGBFrom[2];

Canvas.Pen.Style := psSolid;

Canvas.Pen.Mode := pmCopy;

ColorBand.Left := 0;

ColorBand.Right:= canvas.ClipRect.Right-Canvas.ClipRect.Left;

for I := 0 to $ff do

begin

ColorBand.Top := MulDiv (I , canvas.ClipRect.Bottom-Canvas.ClipRect.Top, $100);

ColorBand.Bottom := MulDiv (I + 1,canvas.ClipRect.Bottom-Canvas.ClipRect.Top, $100);

R := RGBFrom[0] + MulDiv (I, RGBDiff[0], $ff);

G := RGBFrom[1] + MulDiv (I, RGBDiff[1], $ff);

B := RGBFrom[2] + MulDiv (I, RGBDiff[2], $ff);

Canvas.Brush.Color := RGB (R, G, B);

Canvas.FillRect (ColorBand);end;end;

procedure TForm3.paint(Sender: TObject);

begin

GradientRect (clBlue, clBlack, Canvas);

end;

procedure TForm3.BitBtn6Click(Sender: TObject);

begin

Form3.Close;