DataGrid.HitTestInfo.Nowhere Field

 

Indicates that a coordinate corresponds to part of the System.Windows.Forms.DataGrid control that is not functioning.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public static readonly DataGrid.HitTestInfo Nowhere

Other parts of the System.Windows.Forms.DataGrid, such as the Caption, can return useful information. If the part of the grid has no function (such as the gray area behind a sparsely populated grid table), the Nowhere field is returned.

The following example tests whether the user is clicking an area of the grid that is not valid.

private void dataGrid1_MouseDown
(object sender, System.Windows.Forms.MouseEventArgs e)
{
   if(dataGrid1.HitTest(e.X,e.Y).Equals (DataGrid.HitTestInfo.Nowhere)) 
   {
      Console.WriteLine("Nowhere");
   }
}

.NET Framework
Available since 1.1
Return to top
Show: