Gets elements by their location inside the grid.
Namespace: Dapfor.Net.UiAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public HitTestInfo HitTest( Point pt ) |
Visual Basic |
---|
Public Function HitTest ( pt As Point ) As HitTestInfo |
Visual C++ |
---|
public: HitTestInfo HitTest( Point pt ) |
F# |
---|
member HitTest : pt : Point -> HitTestInfo |
Parameters
- pt
- Type: System.Drawing..::..Point
Location inside the grid.
Return Value
Type: HitTestInfo[Missing <returns> documentation for "M:Dapfor.Net.Ui.Grid.HitTest(System.Drawing.Point)"]
Remarks
The grid has a convenient system of getting elements by their location inside the grid. This is done with Grid.HitTest()
method that returns type of element in specified position. To get the element itself you can use one of Grid.HitTests methods
that return element pointers. We tried to create an API to avoid unnecessary type casting. An example of its use is provided below.
Copy | |
---|---|
public void HitTestExample(Grid grid) { //Get the current cursor position Point position = System.Windows.Forms.Cursor.Position; //Get position in the client coordinates position = grid.PointToClient(position); //Get a part of the grid, the cursor points to. HitTestInfo info = grid.HitTest(position); //Try get a header, the cursor points to. Header header = grid.HitTests.HeaderTest(position); //Try get a row, the cursor points to. Row row = grid.HitTests.RowTest(position); //Try get a cell, the cursor points to. Cell cell = grid.HitTests.CellTest(position); //Try get a column, the cursor points to. Column column = grid.HitTests.ColumnTest(position); //Do something... } |