Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
How can I find the location of the cell that I clicked on off the wingrid with respect to the entire screen
posted

I'm trying to find the coordinates to the clicked cell with respect to the screen -- FYI, I am working off a dual monitor, so I expect that location size to consider that fact. t hankx

  • 37774
    Verified Answer
    posted

    If you just want to use the MouseDown event, you could do something like:

    private void ultraGrid1_MouseDown(object sender, MouseEventArgs e)
    {
        Point locationInScreenCoordinates = this.ultraGrid1.PointToScreen(e.Location);
        MessageBox.Show(locationInScreenCoordinates.ToString());
    }

    If you have 8.3 or higher, there is a ClickCell event you can use, then get the UIElement from the cell:

    private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
    {
        UIElement element = e.Cell.GetUIElement();
        Point locationInScreenCoordinates = this.ultraGrid1.PointToScreen(element.Rect.Location);
        MessageBox.Show(locationInScreenCoordinates.ToString());
    }

    -Matt