ОффтопикВот этот КОД:
procedure TForm3.FormShow(Sender: TObject);
var
est: bool;
i:byte;
nom:byte;
begin
nom:=0;
est:=false;
if ComboBox1.Items.Count>0 then
Begin
for i:=0 to ComboBox1.Items.Count-1 do
if picOpen[selPic] = picHist[i] then
begin
est:=true;
nom:=i;
end;
if est = false then
Begin
Image1.Picture.LoadFromFile(picOpen[selPic]);
ComboBox1.Items.Append(ExtractFileName(picOpen[selPic]));
ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;
SetLength(picHist,Length(picHist)+1);
picHist[High(picHist)]:=picOpen[selPic];
End else
Begin
est:=false;
Image1.Picture.LoadFromFile(picHist[nom]);
ComboBox1.ItemIndex:=nom;
End;
end else
Begin
Image1.Picture.LoadFromFile(picOpen[selPic]);
ComboBox1.Items.Append(ExtractFileName(picOpen[selPic]));
ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;
SetLength(picHist,Length(picHist)+1);
picHist[High(picHist)]:=picOpen[selPic];
end;
end;
procedure TForm3.Button1Click(Sender: TObject);
var
est: bool;
i:byte;
nom:byte;
begin
nom:=0;
est:=false;
if OpenDialog1.Execute then
Begin
for i:=0 to ComboBox1.Items.Count-1 do
if OpenDialog1.FileName = picHist[i] then
begin
est:=true;
nom:=i;
end;
if est = false then
Begin
Image1.Picture.LoadFromFile(OpenDialog1.FileName);
ComboBox1.Items.Append(ExtractFileName(OpenDialog1 .FileName));
ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;
SetLength(picHist,Length(picHist)+1);
picHist[High(picHist)]:=OpenDialog1.FileName;
End
else
Begin
est:=false;
Image1.Picture.LoadFromFile(picHist[nom]);
ComboBox1.ItemIndex:=nom;
End;
End;
end;
procedure TForm3.ComboBox1CloseUp(Sender: TObject);
begin
Image1.Picture.LoadFromFile(picHist[ComboBox1.ItemIndex]);
end;