Skip to main content Skip to footer

Get the coordinates of a C1TileControl Tile with respect to the form

Background:

When you place a tile on the form it is placed inside the group. X and Y property of tile returns the coordinates of tile with respect to the parent group of that tile.

Steps to Complete:

To find the co-ordinates of the Tile with respect to the form, handle the Click event of the Tile as given in code snippet below:

int x_cor;
int y_cor;
private void tile_Click(object sender, EventArgs e)
{
  Tile myTile = (Tile)sender;
    if (myTile.Group!=null)
       {
         x_cor = myTile.X + myTile.Group.X;
        y_cor = myTile.Y + myTile.Group.Y;
        MessageBox.Show(string.Format("X:{0},Y:{1}", x_cor, y_cor));
       }
  }

Prabhat Sharma