title: How to place a control in windows forms in a gridview with relative position rather than a fixed position
body: <p>I'm trying to place a time picker control on the cell of my grid view, using the current cell location as in the below code.</p>
  
  <pre><code>dtpTerminationDate.Location = gvEmployeeTermination
     .GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False).Location
  </code></pre>
  
  <p><code>dtpTerminationDate</code> is my <code>TimePicker</code> object.</p>
  
  <p>This is getting placed fine initially, but the issue is my grid view has a horizontal scroll. So, when I scroll, the UI is distorted.</p>
  
  <p>Before scrolling,</p>
  
  <p><a href="https://i.stack.imgur.com/6BUph.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6BUph.png" alt="Before scrolling"></a></p>
  
  <p>After scrolling,</p>
  
  <p><a href="https://i.stack.imgur.com/YVvmr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YVvmr.png" alt="After scrolling"></a></p>
  
  <p>Can someone please help me to position the <code>TimePicker</code> even when I scroll the gridview.</p>