# C1.Win.FlexGrid.C1FlexGridBase.MouseEnterCell

## Content

<div class="doc-site-dotnet-api-container">




<h1 id="C1_Win_FlexGrid_C1FlexGridBase_MouseEnterCell" data-uid="C1.Win.FlexGrid.C1FlexGridBase.MouseEnterCell" class="text-break">MouseEnterCell Event
</h1>
<div class="markdown level0 summary"><p>Fires when the mouse enters a cell.</p>
</div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>: <a class="xref" href="C1.Win.FlexGrid.html">C1.Win.FlexGrid</a></h6>
<h6><strong>Assembly</strong>: C1.Win.FlexGrid.10.dll</h6>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_MouseEnterCell_syntax">Syntax</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public event RowColEventHandler MouseEnterCell</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Event MouseEnterCell As RowColEventHandler</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.RowColEventHandler.html">RowColEventHandler</a></td>
      <td>Fires when the mouse enters a cell.</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_MouseEnterCell_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>Many applications track mouse movement and react to the cell that is currently
under the mouse. This can be done using the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.control.mousemove">MouseMove</a> event, but that 
is not very efficient since the event fires many times while the mouse is over the 
same cell.</p>
<p>The <b>MouseEnterCell</b> event allows you to implement cell tracking 
efficiently, since it only fires once until the mouse leaves the cell.</p>
</div>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_MouseEnterCell_examples"><strong>Examples</strong></h5>
<p>The code below tracks mouse movement and highlights the cell under the mouse:</p>
<pre><code class="lang-csharp">void Form1_Load(object sender, EventArgs e)
{
  // create style for tracking cell under the mouse
  CellStyle cs = _flex.Styles.Add("track");
  cs.BackColor = Color.Gold;
}
void _flex_MouseEnterCell(object sender, RowColEventArgs e)
{
  // apply tracking style when mouse enters the cell
  _flex.SetCellStyle(e.Row, e.Col, _flex.Styles["track"]);
}
void _flex_MouseLeaveCell(object sender, RowColEventArgs e)
{
  // remove tracking style when mouse leaves the cell
  _flex.SetCellStyle(e.Row, e.Col, (CellStyle)null);
}</code></pre>

</div>
