# C1.Win.FlexGrid.C1FlexGridBase.HitTest

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest*">HitTest Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_System_Int32_System_Int32_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest(System.Int32,System.Int32)">HitTest(int, int)</h4>
<div class="markdown level1 summary"><p>Returns information about the control at a specified point on the control surface.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public HitTestInfo HitTest(int x, int y)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function HitTest(x As Integer, y As Integer) As HitTestInfo</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">x</span></td>
      <td><p>The horizontal position of the client coordinate.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">y</span></td>
      <td><p>The vertical position of the client coordinate.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.HitTestInfo.html">HitTestInfo</a></td>
      <td><p>A <a class="xref" href="C1.Win.FlexGrid.HitTestInfo.html">HitTestInfo</a> object that contains information about the point.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_System_Int32_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method is especially useful when handling the <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.BeforeMouseDown.html">BeforeMouseDown</a> event.
It allows you to determine whether the mouse is over a specific cell, grid buttons,
resizing elements, etc.</p>
</div>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_System_Int32_System_Int32__examples">Examples</h5>
<p>The code below shows hit test information whenever the user clicks the mouse:</p>
<pre><code class="lang-csharp">void _flex_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e)
{
  HitTestInfo hti = _flex.HitTest(e.X, e.Y);
  Console.WriteLine("at {0},{1}: row {2} col {3} type {4}",
                     hti.X, hti.Y, hti.Row, hti.Column, hti.Type);
}</code></pre>



<a id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_System_Drawing_Point_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest(System.Drawing.Point)">HitTest(Point)</h4>
<div class="markdown level1 summary"><p>Returns information about the control at a specified point on the control surface.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public HitTestInfo HitTest(Point pt)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function HitTest(pt As Point) As HitTestInfo</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a></td>
      <td><span class="parametername">pt</span></td>
      <td><p><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a> in client coordinates.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.HitTestInfo.html">HitTestInfo</a></td>
      <td><p>A <a class="xref" href="C1.Win.FlexGrid.HitTestInfo.html">HitTestInfo</a> object that contains information about the point.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_System_Drawing_Point__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method is especially useful when handling the <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.BeforeMouseDown.html">BeforeMouseDown</a> event.
It allows you to determine whether the mouse is over a specific cell, grid buttons,
resizing elements, etc.</p>
</div>


<a id="C1_Win_FlexGrid_C1FlexGridBase_HitTest_" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGridBase_HitTest" data-uid="C1.Win.FlexGrid.C1FlexGridBase.HitTest">HitTest()</h4>
<div class="markdown level1 summary"><p>Returns information about the control at the current mouse position.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public HitTestInfo HitTest()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function HitTest() As HitTestInfo</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.HitTestInfo.html">HitTestInfo</a></td>
      <td><p>A <a class="xref" href="C1.Win.FlexGrid.HitTestInfo.html">HitTestInfo</a> object that contains information about the point.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
