# C1.Win.FlexGrid.C1FlexGridBase.BeforeMouseDown

## Content

<div class="doc-site-dotnet-api-container">




<h1 id="C1_Win_FlexGrid_C1FlexGridBase_BeforeMouseDown" data-uid="C1.Win.FlexGrid.C1FlexGridBase.BeforeMouseDown" class="text-break">BeforeMouseDown Event
</h1>
<div class="markdown level0 summary"><p>Fires before the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.control.mousedown">MouseDown</a> event is handled by the grid.</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_BeforeMouseDown_syntax">Syntax</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public event BeforeMouseDownEventHandler BeforeMouseDown</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Event BeforeMouseDown As BeforeMouseDownEventHandler</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.BeforeMouseDownEventHandler.html">BeforeMouseDownEventHandler</a></td>
      <td>Fires before the  event is handled by the grid.</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_BeforeMouseDown_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>This event fires before the grid processes the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.forms.control.mousedown">MouseDown</a> event, and
gives the program a chance to customize the behavior of the control and optionally
cancel the default handling of the mouse.</p>
</div>
<h5 id="C1_Win_FlexGrid_C1FlexGridBase_BeforeMouseDown_examples"><strong>Examples</strong></h5>
<p>The code below handles the <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.BeforeMouseDown.html">BeforeMouseDown</a> event to detect clicks
on row headers and provide OLE drag and drop functionality.</p>
<pre><code class="lang-csharp">void _flex_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e)
{
	// start dragging when the user clicks the row headers
	HitTestInfo hti = _flex.HitTest(e.X, e.Y);
	if (hti.Type == HitTestTypeEnum.RowHeader)
	{
		e.Cancel = true;  // cancel default handling
		HandleRowDragDrop(hti.Row); // handle row drag/drop
	}
}</code></pre>

</div>
