unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls, ExtCtrls, Buttons;

type
  TForm1 = class(TForm)
    SpeedButton1: TSpeedButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    Label3: TLabel;
    Label4: TLabel;
    StringGrid1: TStringGrid;
    StringGrid2: TStringGrid;
    Button1: TButton;
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure StringGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Timer1Timer(Sender: TObject);
    procedure StringGrid2Click(Sender: TObject);
    procedure StringGrid2MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure StringGrid2DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
xx,yy:integer;
a,b:integer;
 dost:integer;
 vigralkom:integer;
implementation

{$R *.dfm}

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
  var
  img, img1, img2, img3: TPicture;

  begin

  label1.Caption:=inttostr(acol);
   label2.Caption:=inttostr(arow);
// создание графического объекта
  img := TPicture.Create;

  // загрузка в графическую переменную изображения из внешнего файла
  img.LoadFromFile('1\1.bmp');



  // условие, определяющее нужную ячейку
  if ((ACol = 2) and (ARow = 1)) then begin


        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img.Graphic);
   end;

    if ((ACol = 10) and (ARow = 10)) then begin


        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img.Graphic);
   end;

    if ((ACol = 1) and (ARow = 10)) then  begin

        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img.Graphic);
   end;

    if ((ACol = 10) and (ARow = 1)) then begin

     
        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img.Graphic);
   end;

   // создание графического объекта
  img1 := TPicture.Create;

  // загрузка в графическую переменную изображения из внешнего файла
  img1.LoadFromFile('2\1.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 3) and (ARow = 3)) then begin

        // назначение размера ячейки по ширине и высоте


        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img1.Graphic);
   end;
    img1 := TPicture.Create;

  // загрузка в графическую переменную изображения из внешнего файла
  img1.LoadFromFile('2\2.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 4) and (ARow = 3)) then begin

        // назначение размера ячейки по ширине и высоте
        

        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img1.Graphic);
   end;
   //второй двухпалубный

  img1.LoadFromFile('2\1.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 8) and (ARow = 8)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img1.Graphic);
   end;

   img1.LoadFromFile('2\2.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 9) and (ARow = 8)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img1.Graphic);
   end;
  //третий двухпалубный

  img1.LoadFromFile('2\1.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 2) and (ARow = 8)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img1.Graphic);
   end;

   img1.LoadFromFile('2\2.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 3) and (ARow = 8)) then begin


        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img1.Graphic);
   end;
     /////////трехпалубный
    img2 := TPicture.Create;

  // загрузка в графическую переменную изображения из внешнего файла
  img2.LoadFromFile('3\1.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 6) and (ARow = 3)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img2.Graphic);
   end;

   img2.LoadFromFile('3\2.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 7) and (ARow = 3)) then begin


        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img2.Graphic);
   end;

    img2.LoadFromFile('3\3.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 8) and (ARow = 3)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img2.Graphic);
   end;
   ////первый трехпалубный
   /////// второй трехпалубный
    img2.LoadFromFile('3\1.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 4) and (ARow = 10)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img2.Graphic);
   end;

   img2.LoadFromFile('3\2.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 5) and (ARow = 10)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img2.Graphic);
   end;

   img2.LoadFromFile('3\3.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 6) and (ARow = 10)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img2.Graphic);
   end;
   ///четырехпалубный
   img3 := TPicture.Create;

  // загрузка в графическую переменную изображения из внешнего файла
  img3.LoadFromFile('4\1.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 4) and (ARow = 5)) then begin

       

        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img3.Graphic);
   end;

   img3.LoadFromFile('4\2.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 5) and (ARow = 5)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img3.Graphic);
   end;

      img3.LoadFromFile('4\3.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 6) and (ARow = 5)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img3.Graphic);
   end;

      img3.LoadFromFile('4\4.bmp');

  // условие, определяющее нужную ячейку
  if ((ACol = 7) and (ARow = 5)) then begin



        // вывод рисунка в текущей ячейке
        StringGrid1.Canvas.StretchDraw(Rect, img3.Graphic);
   end;

end;

procedure TForm1.Button1Click(Sender: TObject);
var
 a:integer ;
begin
Button1.Caption:=IntTostr(Random(10)+1);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
vigralkom:=0;
StringGrid1.Cells[1,0]:='1';
StringGrid1.Cells[2,0]:='2';
StringGrid1.Cells[3,0]:='3';
StringGrid1.Cells[4,0]:='4';
StringGrid1.Cells[5,0]:='5';
StringGrid1.Cells[6,0]:='6';
StringGrid1.Cells[7,0]:='7';
StringGrid1.Cells[8,0]:='8';
StringGrid1.Cells[9,0]:='9';
StringGrid1.Cells[10,0]:='10';

StringGrid1.Cells[0,1]:='1';
StringGrid1.Cells[0,2]:='2';
StringGrid1.Cells[0,3]:='3';
StringGrid1.Cells[0,4]:='4';
StringGrid1.Cells[0,5]:='5';
StringGrid1.Cells[0,6]:='6';
StringGrid1.Cells[0,7]:='7';
StringGrid1.Cells[0,8]:='8';
StringGrid1.Cells[0,9]:='9';
StringGrid1.Cells[0,10]:='10';
/////////////////////////////////////
StringGrid2.Cells[1,0]:='1';
StringGrid2.Cells[2,0]:='2';
StringGrid2.Cells[3,0]:='3';
StringGrid2.Cells[4,0]:='4';
StringGrid2.Cells[5,0]:='5';
StringGrid2.Cells[6,0]:='6';
StringGrid2.Cells[7,0]:='7';
StringGrid2.Cells[8,0]:='8';
StringGrid2.Cells[9,0]:='9';
StringGrid2.Cells[10,0]:='10';

StringGrid2.Cells[0,1]:='1';
StringGrid2.Cells[0,2]:='2';
StringGrid2.Cells[0,3]:='3';
StringGrid2.Cells[0,4]:='4';
StringGrid2.Cells[0,5]:='5';
StringGrid2.Cells[0,6]:='6';
StringGrid2.Cells[0,7]:='7';
StringGrid2.Cells[0,8]:='8';
StringGrid2.Cells[0,9]:='9';
StringGrid2.Cells[0,10]:='10';
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
 var
 Rect:Trect;
a1,a11:TPoint;
b1,b11:TPoint; ///однопалубный
c1,c11:TPoint;
d1,d11:TPoint;
e1,e11:TPoint;
f1,f11:TPoint;
g1,g11:TPoint;
i1,i11:TPoint;
k1,k11:TPoint;
l1,l11:TPoint; ///однопалубный
///конец первая горизонталь
a2,a22:TPoint;
b2,b22:TPoint;
c2,c22:TPoint;
d2,d22:TPoint;
e2,e22:TPoint;
f2,f22:TPoint;
g2,g22:TPoint;
i2,i22:TPoint;
k2,k22:TPoint;
l2,l22:TPoint;
///конец вторая горизонталь
a3,a33:TPoint;
b3,b33:TPoint;
c3,c33:TPoint;
d3,d33:TPoint;
e3,e33:TPoint;
f3,f33:TPoint;
g3,g33:TPoint;
i3,i33:TPoint;
k3,k33:TPoint;
l3,l33:TPoint;
///конец третья горизонталь
a4,a44:TPoint;
b4,b44:TPoint;
c4,c44:TPoint;
d4,d44:TPoint;
e4,e44:TPoint;
f4,f44:TPoint;
g4,g44:TPoint;
i4,i44:TPoint;
k4,k44:TPoint;
l4,l44:TPoint;
///конец четвертая горизонталь
a5,a55:TPoint;
b5,b55:TPoint;
c5,c55:TPoint;
d5,d55:TPoint;
e5,e55:TPoint;
f5,f55:TPoint;
g5,g55:TPoint;
i5,i55:TPoint;
k5,k55:TPoint;
l5,l55:TPoint;
///конец пятая горизонталь
a6,a66:TPoint;
b6,b66:TPoint;
c6,c66:TPoint;
d6,d66:TPoint;
e6,e66:TPoint;
f6,f66:TPoint;
g6,g66:TPoint;
i6,i66:TPoint;
k6,k66:TPoint;
l6,l66:TPoint;
///конец шестой горизонталь
a7,a77:TPoint;
b7,b77:TPoint;
c7,c77:TPoint;
d7,d77:TPoint;
e7,e77:TPoint;
f7,f77:TPoint;
g7,g77:TPoint;
i7,i77:TPoint;
k7,k77:TPoint;
l7,l77:TPoint;
///конец седьмая горизонталь
a8,a88:TPoint;
b8,b88:TPoint;
c8,c88:TPoint;
d8,d88:TPoint;
e8,e88:TPoint;
f8,f88:TPoint;
g8,g88:TPoint;
i8,i88:TPoint;
k8,k88:TPoint;
l8,l88:TPoint;
///конец восьмая горизонталь
a9,a99:TPoint;
b9,b99:TPoint;
c9,c99:TPoint;
d9,d99:TPoint;
e9,e99:TPoint;
f9,f99:TPoint;
g9,g99:TPoint;
i9,i99:TPoint;
k9,k99:TPoint;
l9,l99:TPoint;
///конец девятая горизонталь
a10,a1010:TPoint;
b10,b1010:TPoint;
c10,c1010:TPoint;
d10,d1010:TPoint;
e10,e1010:TPoint;
f10,f1010:TPoint;
g10,g1010:TPoint;
i10,i1010:TPoint;
k10,k1010:TPoint;
l10,l1010:TPoint;
///конец деcятая горизонталь

img4,img5:TPicture;
begin



Randomize();
xx:=Random(10)+1;
yy:=Random(10)+1;
Edit1.Text:=inttostr( xx);
Edit2.Text:=inttostr( yy);
 img4 := TPicture.Create;
 img4.LoadFromFile('5\1.bmp');

 img5 := TPicture.Create;
 img5.LoadFromFile('6\1.bmp');

if ((xx=1) and (yy=1)) then
begin
a1.X:=28;
a1.Y:=24;
a11.X:=55;
a11.Y:=48;
Rect.TopLeft:=a1 ;
Rect.BottomRight:=a11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=1) and (yy=2)) then
begin
a1.X:=58;
a1.Y:=24;
a11.X:=80;
a11.Y:=48;
Rect.TopLeft:=a1 ;
Rect.BottomRight:=a11;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=1) and (yy=3)) then
begin
c1.X:=82;
c1.Y:=24;
c11.X:=110;
c11.Y:=48;
Rect.TopLeft:=c1 ;
Rect.BottomRight:=c11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);

end;

if ((xx=1) and (yy=4)) then
begin
d1.X:=112;
d1.Y:=24;
d11.X:=141;
d11.Y:=48;
Rect.TopLeft:=d1 ;
Rect.BottomRight:=d11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);

end;

if ((xx=1) and (yy=5)) then
begin
e1.X:=143;
e1.Y:=24;
e11.X:=167;
e11.Y:=48;
Rect.TopLeft:=e1 ;
Rect.BottomRight:=e11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=1) and (yy=6)) then
begin
f1.X:=170;
f1.Y:=26;
f11.X:=196;
f11.Y:=48;
Rect.TopLeft:=f1 ;
Rect.BottomRight:=f11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=1) and (yy=7)) then
begin
g1.X:=198;
g1.Y:=26;
g11.X:=223;
g11.Y:=48;
Rect.TopLeft:=g1 ;
Rect.BottomRight:=g11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=1) and (yy=8)) then
begin
i1.X:=227;
i1.Y:=26;
i11.X:=248;
i11.Y:=48;
Rect.TopLeft:=i1 ;
Rect.BottomRight:=i11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=1) and (yy=9)) then
begin
k1.X:=252;
k1.Y:=26;
k11.X:=275;
k11.Y:=48;
Rect.TopLeft:=k1 ;
Rect.BottomRight:=k11;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=1) and (yy=10)) then
begin
l1.X:=280;
l1.Y:=26;
l11.X:=305;
l11.Y:=48;
Rect.TopLeft:=l1 ;
Rect.BottomRight:=l11;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;
// вторая горизонталь
if ((xx=2) and (yy=1)) then
begin
a2.X:=28;
a2.Y:=49;
a22.X:=56;
a22.Y:=73;
Rect.TopLeft:=a2 ;
Rect.BottomRight:=a22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=2)) then
begin
b2.X:=57;
b2.Y:=49;
b22.X:=82;
b22.Y:=73;
Rect.TopLeft:=b2 ;
Rect.BottomRight:=b22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=3)) then
begin
c2.X:=83;
c2.Y:=49;
c22.X:=110;
c22.Y:=73;
Rect.TopLeft:=c2 ;
Rect.BottomRight:=c22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=4)) then
begin
d2.X:=112;
d2.Y:=49;
d22.X:=140;
d22.Y:=73;
Rect.TopLeft:=d2 ;
Rect.BottomRight:=d22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=5)) then
begin
e2.X:=143;
e2.Y:=49;
e22.X:=169;
e22.Y:=73;
Rect.TopLeft:=e2 ;
Rect.BottomRight:=e22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=6)) then
begin
f2.X:=171;
f2.Y:=49;
f22.X:=196;
f22.Y:=73;
Rect.TopLeft:=f2 ;
Rect.BottomRight:=f22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=7)) then
begin
g2.X:=198;
g2.Y:=49;
g22.X:=225;
g22.Y:=73;
Rect.TopLeft:=g2 ;
Rect.BottomRight:=g22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=8)) then
begin
i2.X:=226;
i2.Y:=49;
i22.X:=251;
i22.Y:=73;
Rect.TopLeft:=i2 ;
Rect.BottomRight:=i22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=9)) then
begin
k2.X:=251;
k2.Y:=49;
k22.X:=279;
k22.Y:=73;
Rect.TopLeft:=k2 ;
Rect.BottomRight:=k22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=2) and (yy=10)) then
begin
l2.X:=280;
l2.Y:=49;
l22.X:=307;
l22.Y:=73;
Rect.TopLeft:=l2 ;
Rect.BottomRight:=l22;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;
// третья горизонталь
if ((xx=3) and (yy=1)) then
begin
a3.X:=28;
a3.Y:=76;
a33.X:=56;
a33.Y:=96;
Rect.TopLeft:=a3 ;
Rect.BottomRight:=a33;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=3) and (yy=2)) then
begin
b3.X:=57;
b3.Y:=76;
b33.X:=81;
b33.Y:=96;
Rect.TopLeft:=b3 ;
Rect.BottomRight:=b33;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=3) and (yy=3)) then
begin
c3.X:=84;
c3.Y:=76;                           //двухпалубный
c33.X:=108;
c33.Y:=96;
Rect.TopLeft:=c3 ;
Rect.BottomRight:=c33;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=3) and (yy=4)) then
begin
d3.X:=114;
d3.Y:=76;                           //двухпалубный
d33.X:=136;
d33.Y:=96;
Rect.TopLeft:=d3 ;
Rect.BottomRight:=d33;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=3) and (yy=5)) then
begin
e3.X:=142;
e3.Y:=76;
e33.X:=169;
e33.Y:=96;
Rect.TopLeft:=e3 ;
Rect.BottomRight:=e33;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=3) and (yy=6)) then
begin
f3.X:=171;
f3.Y:=76;
f33.X:=195;                                       //трехпалубный
f33.Y:=96;
Rect.TopLeft:=f3 ;
Rect.BottomRight:=f33;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=3) and (yy=7)) then
begin
g3.X:=200;
g3.Y:=76;
g33.X:=221;
g33.Y:=96;
Rect.TopLeft:=g3 ;
Rect.BottomRight:=g33;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);  //трехпалубный
end;

if ((xx=3) and (yy=8)) then
begin
i3.X:=221;
i3.Y:=76;
i33.X:=245;
i33.Y:=96;
Rect.TopLeft:=i3 ;
Rect.BottomRight:=i33;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);  //трехпалубный
end;

if ((xx=3) and (yy=9)) then
begin
k3.X:=252;
k3.Y:=76;
k33.X:=279;
k33.Y:=96;
Rect.TopLeft:=k3 ;
Rect.BottomRight:=k33;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=3) and (yy=10)) then
begin
l3.X:=281;
l3.Y:=76;
l33.X:=307;
l33.Y:=96;
Rect.TopLeft:=l3 ;
Rect.BottomRight:=l33;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

///четвертая горизонталь
if ((xx=4) and (yy=1)) then
begin
a4.X:=28;
a4.Y:=100;
a44.X:=56;
a44.Y:=123;
Rect.TopLeft:=a4 ;
Rect.BottomRight:=a44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=2)) then
begin
b4.X:=57;
b4.Y:=100;
b44.X:=81;
b44.Y:=123;
Rect.TopLeft:=b4 ;
Rect.BottomRight:=b44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=3)) then
begin
c4.X:=83;
c4.Y:=100;
c44.X:=112;
c44.Y:=123;
Rect.TopLeft:=c4 ;
Rect.BottomRight:=c44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=4)) then
begin
d4.X:=111;
d4.Y:=100;
d44.X:=138;
d44.Y:=123;
Rect.TopLeft:=d4 ;
Rect.BottomRight:=d44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=5)) then
begin
e4.X:=142;
e4.Y:=100;
e44.X:=169;
e44.Y:=123;
Rect.TopLeft:=e4 ;
Rect.BottomRight:=e44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=6)) then
begin
f4.X:=169;
f4.Y:=100;
f44.X:=196;
f44.Y:=123;
Rect.TopLeft:=f4 ;
Rect.BottomRight:=f44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=7)) then
begin
g4.X:=197;
g4.Y:=100;
g44.X:=223;
g44.Y:=123;
Rect.TopLeft:=g4 ;
Rect.BottomRight:=g44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=8)) then
begin
i4.X:=224;
i4.Y:=100;
i44.X:=250;
i44.Y:=123;
Rect.TopLeft:=i4 ;
Rect.BottomRight:=i44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=9)) then
begin
k4.X:=252;
k4.Y:=100;
k44.X:=279;
k44.Y:=123;
Rect.TopLeft:=k4 ;
Rect.BottomRight:=k44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=4) and (yy=10)) then
begin
l4.X:=281;
l4.Y:=100;
l44.X:=307;
l44.Y:=123;
Rect.TopLeft:=l4 ;
Rect.BottomRight:=l44;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;
///Пятая горизонталь
if ((xx=5) and (yy=1)) then
begin
a5.X:=28;
a5.Y:=124;
a55.X:=56;
a55.Y:=148;
Rect.TopLeft:=a5 ;
Rect.BottomRight:=a55;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=5) and (yy=2)) then
begin
b5.X:=57;
b5.Y:=124;
b55.X:=81;
b55.Y:=148;
Rect.TopLeft:=b5 ;
Rect.BottomRight:=b55;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=5) and (yy=3)) then
begin
c5.X:=83;
c5.Y:=124;
c55.X:=112;
c55.Y:=148;
Rect.TopLeft:=c5 ;
Rect.BottomRight:=c55;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=5) and (yy=4)) then
begin
d5.X:=111;
d5.Y:=124;                        //четырехпалубный
d55.X:=138;
d55.Y:=148;
Rect.TopLeft:=d5 ;
Rect.BottomRight:=d55;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=5) and (yy=5)) then
begin
e5.X:=142;
e5.Y:=124;
e55.X:=169;
e55.Y:=148;
Rect.TopLeft:=e5 ;
Rect.BottomRight:=e55;    //четырехпалубный
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=5) and (yy=6)) then
begin
f5.X:=169;
f5.Y:=124;                          //четырехпалубный
f55.X:=196;
f55.Y:=148;
Rect.TopLeft:=f5 ;
Rect.BottomRight:=f55;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=5) and (yy=7)) then
begin
g5.X:=197;
g5.Y:=124;
g55.X:=223;                      //четырехпалубный
g55.Y:=148;
Rect.TopLeft:=g5 ;
Rect.BottomRight:=g55;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=5) and (yy=8)) then
begin
i5.X:=224;
i5.Y:=124;
i55.X:=250;
i55.Y:=148;
Rect.TopLeft:=i5 ;
Rect.BottomRight:=i55;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=5) and (yy=9)) then
begin
k5.X:=252;
k5.Y:=124;
k55.X:=279;
k55.Y:=148;
Rect.TopLeft:=k5 ;
Rect.BottomRight:=k55;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=5) and (yy=10)) then
begin
l5.X:=281;
l5.Y:=124;
l55.X:=307;
l55.Y:=148;
Rect.TopLeft:=l5 ;
Rect.BottomRight:=l55;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;
//шестая горизонталь
if ((xx=6) and (yy=1)) then
begin
a6.X:=29;
a6.Y:=150;
a66.X:=54;
a66.Y:=171;
Rect.TopLeft:=a6 ;
Rect.BottomRight:=a66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=2)) then
begin
b6.X:=57;
b6.Y:=150;
b66.X:=79;
b66.Y:=171;
Rect.TopLeft:=b6 ;
Rect.BottomRight:=b66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=3)) then
begin
c6.X:=83;
c6.Y:=150;
c66.X:=110;
c66.Y:=171;
Rect.TopLeft:=c6 ;
Rect.BottomRight:=c66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=4)) then
begin
d6.X:=113;
d6.Y:=150;
d66.X:=141;
d66.Y:=174;
Rect.TopLeft:=d6 ;
Rect.BottomRight:=d66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=5)) then
begin
e6.X:=142;
e6.Y:=150;
e66.X:=167;
e66.Y:=174;
Rect.TopLeft:=e6 ;
Rect.BottomRight:=e66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=6)) then
begin
f6.X:=171;
f6.Y:=150;
f66.X:=194;
f66.Y:=174;
Rect.TopLeft:=f6 ;
Rect.BottomRight:=f66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=7)) then
begin
g6.X:=199;
g6.Y:=150;
g66.X:=221;
g66.Y:=174;
Rect.TopLeft:=g6 ;
Rect.BottomRight:=g66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=8)) then
begin
i6.X:=224;
i6.Y:=150;
i66.X:=248;
i66.Y:=174;
Rect.TopLeft:=i6 ;
Rect.BottomRight:=i66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=9)) then
begin
k6.X:=252;
k6.Y:=150;
k66.X:=277;
k66.Y:=174;
Rect.TopLeft:=k6 ;
Rect.BottomRight:=k66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=6) and (yy=10)) then
begin
l6.X:=281;
l6.Y:=150;
l66.X:=305;
l66.Y:=174;
Rect.TopLeft:=l6 ;
Rect.BottomRight:=l66;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

//седьмая горизонталь
if ((xx=7) and (yy=1)) then
begin
a7.X:=29;
a7.Y:=176;
a77.X:=54;
a77.Y:=198;
Rect.TopLeft:=a7 ;
Rect.BottomRight:=a77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=2)) then
begin
b7.X:=57;
b7.Y:=176;
b77.X:=79;
b77.Y:=198;
Rect.TopLeft:=b7 ;
Rect.BottomRight:=b77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=3)) then
begin
c7.X:=83;
c7.Y:=176;
c77.X:=110;
c77.Y:=198;
Rect.TopLeft:=c7 ;
Rect.BottomRight:=c77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=4)) then
begin
d7.X:=113;
d7.Y:=176;
d77.X:=141;
d77.Y:=198;
Rect.TopLeft:=d7 ;
Rect.BottomRight:=d77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=5)) then
begin
e7.X:=142;
e7.Y:=176;
e77.X:=167;
e77.Y:=198;
Rect.TopLeft:=e7 ;
Rect.BottomRight:=e77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=6)) then
begin
f7.X:=171;
f7.Y:=176;
f77.X:=194;
f77.Y:=198;
Rect.TopLeft:=f7 ;
Rect.BottomRight:=f77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=7)) then
begin
g7.X:=199;
g7.Y:=176;
g77.X:=221;
g77.Y:=198;
Rect.TopLeft:=g7 ;
Rect.BottomRight:=g77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=8)) then
begin
i7.X:=224;
i7.Y:=176;
i77.X:=248;
i77.Y:=198;
Rect.TopLeft:=i7 ;
Rect.BottomRight:=i77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=9)) then
begin
k7.X:=252;
k7.Y:=176;
k77.X:=277;
k77.Y:=198;
Rect.TopLeft:=k7 ;
Rect.BottomRight:=k77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=7) and (yy=10)) then
begin
l7.X:=281;
l7.Y:=176;
l77.X:=305;
l77.Y:=198;
Rect.TopLeft:=l7 ;
Rect.BottomRight:=l77;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

//восьмая горизонталь
if ((xx=8) and (yy=1)) then
begin
a8.X:=29;
a8.Y:=200;
a88.X:=54;
a88.Y:=223;
Rect.TopLeft:=a8 ;
Rect.BottomRight:=a88;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=8) and (yy=2)) then
begin
b8.X:=57;
b8.Y:=200;
b88.X:=79;                              //Двухпалубный
b88.Y:=223;
Rect.TopLeft:=b8 ;
Rect.BottomRight:=b88;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=8) and (yy=3)) then
begin
c8.X:=83;
c8.Y:=200;
c88.X:=110;                      //Двухпалубный
c88.Y:=223;
Rect.TopLeft:=c8 ;
Rect.BottomRight:=c88;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic); 
end;

if ((xx=8) and (yy=4)) then
begin
d8.X:=113;
d8.Y:=200;
d88.X:=141;
d88.Y:=223;
Rect.TopLeft:=d8 ;
Rect.BottomRight:=d88;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=8) and (yy=5)) then
begin
e8.X:=142;
e8.Y:=200;
e88.X:=167;
e88.Y:=223;
Rect.TopLeft:=e8 ;
Rect.BottomRight:=e88;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=8) and (yy=6)) then
begin
f8.X:=171;
f8.Y:=200;
f88.X:=194;
f88.Y:=223;
Rect.TopLeft:=f8 ;
Rect.BottomRight:=f88;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=8) and (yy=7)) then
begin
g8.X:=199;
g8.Y:=200;
g88.X:=221;
g88.Y:=223;
Rect.TopLeft:=g8 ;
Rect.BottomRight:=g88;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=8) and (yy=8)) then
begin
i8.X:=224;
i8.Y:=200;                        //Двухпалубный
i88.X:=248;
i88.Y:=223;
Rect.TopLeft:=i8 ;
Rect.BottomRight:=i88;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=8) and (yy=9)) then
begin
k8.X:=252;
k8.Y:=200;                                 //Двухпалубный
k88.X:=277;
k88.Y:=223;
Rect.TopLeft:=k8 ;
Rect.BottomRight:=k88;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=8) and (yy=10)) then
begin
l8.X:=281;
l8.Y:=200;
l88.X:=305;
l88.Y:=223;
Rect.TopLeft:=l8 ;
Rect.BottomRight:=l88;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

//девятая горизонталь
if ((xx=9) and (yy=1)) then
begin
a9.X:=29;
a9.Y:=225;
a99.X:=54;
a99.Y:=248;
Rect.TopLeft:=a9 ;
Rect.BottomRight:=a99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=2)) then
begin
b9.X:=57;
b9.Y:=225;
b99.X:=79;
b99.Y:=248;
Rect.TopLeft:=b9 ;
Rect.BottomRight:=b99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=3)) then
begin
c9.X:=83;
c9.Y:=225;
c99.X:=110;
c99.Y:=248;
Rect.TopLeft:=c9 ;
Rect.BottomRight:=c99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic); 
end;

if ((xx=9) and (yy=4)) then
begin
d9.X:=113;
d9.Y:=225;
d99.X:=141;
d99.Y:=248;
Rect.TopLeft:=d9 ;
Rect.BottomRight:=d99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=5)) then
begin
e9.X:=142;
e9.Y:=225;
e99.X:=167;
e99.Y:=248;
Rect.TopLeft:=e9 ;
Rect.BottomRight:=e99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=6)) then
begin
f9.X:=171;
f9.Y:=225;
f99.X:=194;
f99.Y:=248;
Rect.TopLeft:=f9 ;
Rect.BottomRight:=f99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=7)) then
begin
g9.X:=199;
g9.Y:=225;
g99.X:=221;
g99.Y:=248;
Rect.TopLeft:=g9 ;
Rect.BottomRight:=g99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=8)) then
begin
i9.X:=224;
i9.Y:=225;
i99.X:=248;
i99.Y:=248;
Rect.TopLeft:=i9 ;
Rect.BottomRight:=i99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=9)) then
begin
k9.X:=252;
k9.Y:=225;
k99.X:=277;
k99.Y:=248;
Rect.TopLeft:=k9 ;
Rect.BottomRight:=k99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=9) and (yy=10)) then
begin
l9.X:=281;
l9.Y:=225;
l99.X:=305;
l99.Y:=248;
Rect.TopLeft:=l9 ;
Rect.BottomRight:=l99;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

//десятая горизонталь
if ((xx=10) and (yy=1)) then
begin
a10.X:=29;
a10.Y:=253;
a1010.X:=54;                     //однопалубный
a1010.Y:=273;
Rect.TopLeft:=a10 ;
Rect.BottomRight:=a1010;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=10) and (yy=2)) then
begin
b10.X:=57;
b10.Y:=253;
b1010.X:=79;
b1010.Y:=273;
Rect.TopLeft:=b10 ;
Rect.BottomRight:=b1010;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=10) and (yy=3)) then
begin
c10.X:=83;
c10.Y:=253;
c1010.X:=110;
c1010.Y:=273;
Rect.TopLeft:=c10 ;
Rect.BottomRight:=c1010;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=10) and (yy=4)) then
begin
d10.X:=113;
d10.Y:=253;
d1010.X:=141;
d1010.Y:=273;
Rect.TopLeft:=d10 ;
Rect.BottomRight:=d1010;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=10) and (yy=5)) then
begin
e10.X:=142;
e10.Y:=253;
e1010.X:=167;
e1010.Y:=273;
Rect.TopLeft:=e10 ;
Rect.BottomRight:=e1010;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=10) and (yy=6)) then
begin
f10.X:=171;
f10.Y:=253;
f1010.X:=194;
f1010.Y:=273;
Rect.TopLeft:=f10 ;
Rect.BottomRight:=f1010;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);
end;

if ((xx=10) and (yy=7)) then
begin
g10.X:=199;
g10.Y:=253;
g1010.X:=221;
g1010.Y:=273;
Rect.TopLeft:=g10 ;
Rect.BottomRight:=g1010;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=10) and (yy=8)) then
begin
i10.X:=224;
i10.Y:=253;
i1010.X:=248;
i1010.Y:=273;
Rect.TopLeft:=i10 ;
Rect.BottomRight:=i1010;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=10) and (yy=9)) then
begin
k10.X:=252;
k10.Y:=253;
k1010.X:=277;
k1010.Y:=273;
Rect.TopLeft:=k10 ;
Rect.BottomRight:=k1010;
StringGrid1.Canvas.StretchDraw(Rect, img4.Graphic);
end;

if ((xx=10) and (yy=10)) then
begin
l10.X:=281;
l10.Y:=253;
l1010.X:=305;           //однопалубный
l1010.Y:=273;
Rect.TopLeft:=l10 ;
Rect.BottomRight:=l1010;
StringGrid1.Canvas.StretchDraw(Rect, img5.Graphic);  
end;



//x:=Random(10)+1;
//y:=Random(10)+1;
//StringGrid1DrawCell(Sender,x,y,rect,state);

         // вывод рисунка в текущей ячейке


//StringGrid1.Cells[x,y]:='1';
end;

procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
Label1.Caption:=inttostr(x);
Label2.Caption:=inttostr(y);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
//SpeedButton1.Click;
if vigralkom=20 then
begin
 ShowMessage('Выграл компьютер');
end;

end;

procedure TForm1.StringGrid2Click(Sender: TObject);
var
Rect1:Trect;
img6:TPicture;
a1,a11:TPoint;
xx,yy:integer;
aa,bb:integer;
begin
{img6 := TPicture.Create;
 img6.LoadFromFile('5\1.bmp');
 
 Stringgrid2.Cells[1,1]:='';
if Stringgrid2.Cells[1,1]='' then
begin
a1.X:=25;
a1.y:=24;
a11.X:=50;
a11.y:=46;
Rect1.TopLeft:=a1;
Rect1.BottomRight:=a11;
StringGrid2.Canvas.StretchDraw(Rect1, img6.Graphic);
StringGrid2.Canvas.StretchDraw(Rect1, img6.Graphic);

}
Randomize();
aa:=random(1)+10;
bb:=random(1)+10;


a := StringGrid2.Col;
b := StringGrid2.Row;

StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('5\1.bmp');

if (a=3) and (b=3) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=9) and (b=5) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;


if (a=7) and (b=8) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=9) and (b=9) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=2) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=4) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=5) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=3) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=4) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=6) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=7) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=8) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=1) and (b=10) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=2) and (b=10) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=3) and (b=10) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=10) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=9) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=8) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;

if (a=7) and (b=1) then
begin
StringGrid2.Objects[a, b] := TBitmap.Create;
(StringGrid2.Objects[a, b] as TBitmap).LoadFromFile('7\1.bmp');
end;




if ((a<>3) or (b<>3)) and ((a<>9) or (b<>5)) and ((a<>7) or (b<>8)) and
((a<>9) or (b<>9)) and ((a<>1) or (b<>1)) and ((a<>2) or (b<>1)) and ((a<>4) or (b<>1))
and ((a<>5) or (b<>1)) and ((a<>1) or (b<>3)) and ((a<>1) or (b<>4)) and ((a<>1) or (b<>6))
and ((a<>1) or (b<>7)) and ((a<>1) or (b<>8)) and ((a<>1) or (b<>10)) and ((a<>2) or (b<>10))
and ((a<>3) or (b<>10)) and ((a<>3) or (b<>10)) and ((a<>10) or (b<>1)) and ((a<>9) or (b<>1))
and ((a<>8) or (b<>1)) and ((a<>7) or (b<>1))   then
begin
SpeedButton1.Click;


end;

end;
procedure TForm1.StringGrid2MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
Label3.Caption:=Inttostr(x);
Label4.Caption:=Inttostr(y);
end;

procedure TForm1.StringGrid2DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin

if StringGrid2.Objects[a, b] is TBitmap then begin
    StringGrid2.Canvas.StretchDraw(StringGrid2.CellRect(a, b), TBitmap(StringGrid2.Objects[a, b]));




end;
end;

end.
