title: Seeking a Winforms System.ComponentModel.Design Design Surface BeginDrag/EndDrag Event Hook
body: <p>I am using C#, Winforms, VS 2017 Enterprise, and the full .NET Framework 4.7.2. </p>
  
  <p>[TLDR section at end!]</p>
  
  <p>I have been working extensively with the <code>System.ComponentModel.Design</code> namespace to create working Visual Studio-like Winforms designer. Setting up the environment for such an end-user forms designer requires deep understanding of objects and interfaces in the aforementioned namespace (and how to wire-up them all) along with toolbox and property grid components. Therefore, it's not possible for me to post a sample of the code. This question requires knowledge of the <code>DesignSurface</code> class (<a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.design.designsurface?view=netframework-4.7.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.design.designsurface?view=netframework-4.7.2</a>).</p>
  
  <p>The design surface seems to fire no event when a user drags a selected control across the designer surface. I need to hook into "begin-drag"/"end-drag" events so that I can perform clear and then re-render an information panel that reflects the current position of all controls. (I do not want to use timers to intermittently refresh that information.)</p>
  
  <p>There is an <code>ISelectionService</code> interface, which I've implemented. But that gives information only about which controls/components are selected. It doesn't help capture the event that fires when a control-drag operation begins or ends.</p>
  
  <p>Details of design-surface events appear here:
  <a href="https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.design?view=netframework-4.7.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.design?view=netframework-4.7.2</a></p>
  
  <p>I have tried to leverage <code>IComponentChangeService's</code> <code>ComponentChanged</code> event, but that fires only after a control-drag operation ends (and I need to detect when the control-drag operation begins and ends)...</p>
  
  <p>As a last resort, I used Spy++ to see what events fire when a control is selected and dragged across the design surface. Spy++ helped me identify the initial <code>WM.LBUTTONDOWN</code> message and various mouse-move messages, etc., but leveraging those messages would require a lot of additional coding to ensure that the mouse button was clicked on a designer-surface control, that the control was in fact selected, and that the mouse button remains down, etc.--and even then, I still would have no assurance that the control isn't being resized versus moved. Of course, ideally, I would want to hook into the designer-surface's logic that responds to drag-begin event. </p>
  
  <p>Finally, my requirement is to detect when a single selected control is dragged or when multiple-selected controls are dragged as a group. In both cases, I need to know when the drag starts and when it ends. (To be clear: I'm referring to controls that already are on the design surface--I am not referring to controls on the toolbox that are drag-dropped onto the designer surface...)</p>
  
  <p><strong>TLDR:</strong>
  What I'm seeking is a way to hook into the event that fires as soon as a control or a group of controls already on a designer surface is/are dragged, and a way to hook into the event that fires when that drag operation has ended. </p>
  
  <p>Any thoughts?</p>