Добрый день, форумчане. Скоро сдавать курсовую, есть рабочая программа, нужно в "procedure TForm1.Button3Click(Sender: TObject);" вставить значение из картинки. Попросили помочь, а сам я плаваю в Delphi, так как только учусь, помогите пожалуйста.
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DB, ADODB;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
StringGrid2: TStringGrid;
Label4: TLabel;
Button6: TButton;
Button7: TButton;
ADOTable1: TADOTable;
ADOConnection1: TADOConnection;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
SG1 : Array[1..4,1..5] Of Real;
SG2 : Array[1..4] Of Real;
i, j, k, buf : Integer;
max : Real;
f:Text;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
k := 1;
For i:=1 To 4 Do
For j:=1 To 5 Do
Begin
If ((k Mod 2) <> 0) Then
StringGrid1.Cells[j-1,i-1] := FloatToStr(k - 1)
Else
StringGrid1.Cells[j-1,i-1] := FloatToStr(k + 1);
k := k + 1;
End;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Randomize;
For i:=1 To 4 Do
For j:=1 To 5 Do
StringGrid1.Cells[j-1,i-1] := FloatToStr(50 - Random(101));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
For i:=1 To 4 Do
For j:=1 To 5 Do
If (StringGrid1.Cells[j-1,i-1]='') Then
SG1[i,j] := 0
Else
SG1[i,j] := StrToFloat(StringGrid1.Cells[j-1,i-1]);
For i:=1 To 4 Do
Begin
max := SG1[i,1];
For j:=2 To 5 Do
If (SG1[i,j] > max) then
max := SG1[i,j];
SG2[i] := max;
End;
For i:=1 To 4 Do
StringGrid2.Cells[0,i-1] := FloatToStr(SG2[i])
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
For i:=1 To 4 Do
For j:=1 To 5 Do
StringGrid1.Cells[j-1,i-1] := ' ';
For i:=1 To 4 Do
Begin
StringGrid2.Cells[0,i-1] := ' ';
SG2[i] := 0;
End;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Close
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
AssignFile(f,GetCurrentDir+'\F.txt');
Reset(f);
For i:=1 To 4 Do
For j:=1 To 5 Do
Begin
Read(f,buf);
StringGrid1.Cells[j-1,i-1] := IntToStr(buf);
End;
CloseFile(f);
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
With ADOTable1 Do
Begin
Active:=True;
First;
For i:=1 To 4 Do
For j:=1 To 5 Do
begin
StringGrid1.Cells[j-1,i-1] := IntToStr(Integer(FieldValues['chislo']));
Next;
End;
end;
AdoConnection1.Close;
end;
end.