แก้ไข

แชร์ผ่าน


DataGrid.HitTestInfo.Nowhere Field

Definition

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

public: static initonly System::Windows::Forms::DataGrid::HitTestInfo ^ Nowhere;
public static readonly System.Windows.Forms.DataGrid.HitTestInfo Nowhere;
 staticval mutable Nowhere : System.Windows.Forms.DataGrid.HitTestInfo
Public Shared ReadOnly Nowhere As DataGrid.HitTestInfo 

Field Value

Examples

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" );
      }
   }
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");
   }
}
Private Sub dataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
    If dataGrid1.HitTest(e.X, e.Y).Equals(DataGrid.HitTestInfo.Nowhere) Then
        Console.WriteLine("Nowhere")
    End If
End Sub

Remarks

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.

Applies to

See also