//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "StringGridMouseToCell.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: StringGridMouseToCell
// Method: Grids.TCustomDrawGrid.MouseToCell

// BeginCode
/*
This example uses a string grid on a form. When the user
selects a cell in the grid and releases the mouse button,
the column and row coordinates for the cell appear in the
cell. The code for displaying the coordinates is written in
the OnMouseUp event handler.  This example requires a
stringgrid.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  StringGrid1->DefaultColWidth = 100;
}

void __fastcall TForm1::StringGrid1MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y)
{
  int Column, Row;
  StringGrid1->MouseToCell(X, Y, Column, Row);
  StringGrid1->Cells[Column][Row] = "Col " + IntToStr(Column) +
									", Row " + IntToStr(Row);
}
// EndCode
// EndExample: StringGridMouseToCell
//---------------------------------------------------------------------------
