DataGrid.HitTestInfo Classe
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Cuidado
DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.
Contém informações sobre uma parte da DataGrid coordenada especificada. Essa classe não pode ser herdada.
public: ref class DataGrid::HitTestInfo sealed
public sealed class DataGrid.HitTestInfo
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public sealed class DataGrid.HitTestInfo
type DataGrid.HitTestInfo = class
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type DataGrid.HitTestInfo = class
Public NotInheritable Class DataGrid.HitTestInfo
- Herança
-
DataGrid.HitTestInfo
- Atributos
Exemplos
O exemplo a seguir usa o HitTest método em um MouseDown evento para retornar o DataGrid.HitTestInfo objeto. A linha, a coluna e a parte da grade são impressas.
private:
void dataGrid1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e )
{
Console::WriteLine();
System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest;
// Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = dataGrid1->HitTest( e->X, e->Y );
Console::WriteLine( myHitTest );
Console::WriteLine( "Column {0}", myHitTest->Column );
Console::WriteLine( "Row {0}", myHitTest->Row );
Console::WriteLine( "Type {0}", myHitTest->Type );
Console::WriteLine( "ToString {0}", myHitTest );
Console::WriteLine( "Hit {0}", myHitTest->Type );
}
private void dataGrid1_MouseDown
(object sender, System.Windows.Forms.MouseEventArgs e)
{
Console.WriteLine();
System.Windows.Forms.DataGrid.HitTestInfo myHitTest;
// Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = dataGrid1.HitTest(e.X,e.Y);
Console.WriteLine(myHitTest);
Console.WriteLine("Column " + myHitTest.Column);
Console.WriteLine("Row " + myHitTest.Row);
Console.WriteLine("Type " + myHitTest.Type);
Console.WriteLine("ToString " + myHitTest.ToString());
Console.WriteLine("Hit " + myHitTest.Type.ToString());
}
Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
Console.WriteLine()
Dim myHitTest As DataGrid.HitTestInfo
' Use the DataGrid control's HitTest method with the x and y properties.
myHitTest = DataGrid1.HitTest(e.X, e.Y)
Console.WriteLine("Column " & myHitTest.Column)
Console.WriteLine("Row " & myHitTest.Row)
Console.WriteLine("Type " & myHitTest.Type)
Console.WriteLine("ToString " & myHitTest.ToString)
Console.WriteLine("Format " & myHitTest.Type.ToString)
End Sub
Comentários
A DataGrid.HitTestInfo classe, em conjunto com o HitTest método do DataGrid controle, é usada para determinar qual parte de um DataGrid controle o usuário clicou. A DataGrid.HitTestInfo classe contém a linha, a coluna e a parte da grade clicada. Consulte a DataGrid.HitTestType enumeração retornada pela Type propriedade para obter uma lista completa de partes da grade.
Para retornar um DataGrid.HitTestInfo, invoque o HitTest método do MouseDown evento de DataGrid controle. Passe as x propriedades e y as MouseEventArgs propriedades do método para o HitTest método.
Campos
| Nome | Description |
|---|---|
| Nowhere |
Obsoleto.
Indica que uma coordenada corresponde a parte do DataGrid controle que não está funcionando. |
Propriedades
| Nome | Description |
|---|---|
| Column |
Obsoleto.
Obtém o número da coluna em que o usuário clicou. |
| Row |
Obsoleto.
Obtém o número da linha que o usuário clicou. |
| Type |
Obsoleto.
Obtém a parte do DataGrid controle, diferente da linha ou coluna, que foi clicada. |
Métodos
| Nome | Description |
|---|---|
| Equals(Object) |
Obsoleto.
Indica se dois objetos são idênticos. |
| GetHashCode() |
Obsoleto.
Obtém o código hash da DataGrid.HitTestInfo instância. |
| GetType() |
Obsoleto.
Obtém o Type da instância atual. (Herdado de Object) |
| MemberwiseClone() |
Obsoleto.
Cria uma cópia superficial do Objectatual. (Herdado de Object) |
| ToString() |
Obsoleto.
Obtém o tipo, o número da linha e o número da coluna. |