title: Detecting the form move event from within a child control
body: <p>I am creating a user control where when a user clicks a button a popup window will show up with information.  The popup window is driven by a toolStripDropDown so when it shows up it does 2 things </p>
  
  <ol>
  <li>Does not move the other controls on the form around but displays over them</li>
  <li>That it can show the details outside the bounds of the user control itself without having to reserve the space ahead of time</li>
  </ol>
  
  <p>Here is some code</p>
  
  <pre><code>Public Class Popup
  Private treeViewHost As ToolStripControlHost
  Private Shadows dropDown As ToolStripDropDown
  
  Public Sub New()
      InitializeComponent()
      Dim treeView As New TreeView()
  
      treeView.BorderStyle = BorderStyle.None
      treeViewHost = New ToolStripControlHost(treeView)
      treeViewHost.Padding = New Padding(6)
  
      dropDown = New ToolStripDropDown()
      dropDown.AutoClose = False
      dropDown.AutoSize = True
      dropDown.BackColor = Color.LemonChiffon
      dropDown.Items.Add(treeViewHost)
  End Sub
  
  Public Sub ShowDropDown()      
      If dropDown.Visible = False Then
          dropDown.Show(Me, Button1.Left + Button1.Height + 5, Button1.Top)
      Else
          dropDown.Close()
      End If
  
  End Sub    
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      ShowDropDown()
  End Sub
  
  Private Sub Popup_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move, Button1.Move
      If (dropDown IsNot Nothing AndAlso Button1 IsNot Nothing AndAlso dropDown.Visible) Then
          dropDown.Left = Button1.Left + Button1.Height + 5
          dropDown.Top = Button1.Top
      End If
  End Sub
  End Class
  </code></pre>
  
  <p>And here is the init of the control </p>
  
  <pre><code>'Required by the Windows Form Designer
  Private components As System.ComponentModel.IContainer
  
  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.  
  'Do not modify it using the code editor.
  &lt;System.Diagnostics.DebuggerStepThrough()&gt; _
  Private Sub InitializeComponent()
      Me.Button1 = New System.Windows.Forms.Button
      Me.SuspendLayout()
      '
      'Button1
      '
      Me.Button1.Location = New System.Drawing.Point(4, 4)
      Me.Button1.Name = "Button1"
      Me.Button1.Size = New System.Drawing.Size(27, 23)
      Me.Button1.TabIndex = 0
      Me.Button1.Text = "Button1"
      Me.Button1.UseVisualStyleBackColor = True
      '
      'Popup
      '
      Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
      Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
      Me.Controls.Add(Me.Button1)
      Me.Name = "Popup"
      Me.Size = New System.Drawing.Size(39, 35)
      Me.ResumeLayout(False)
  
  End Sub
  Friend WithEvents Button1 As System.Windows.Forms.Button
  </code></pre>
  
  <p>Now my issue is as the form moves or resizes the Tooldropdown does not move relative.  I understand that. When I try to capture the move event of the user control that event does not fire when the entire form moves.  There has to be something I can capture because the controls in the container of the form move relative, what drives that?  I tried wndproc but nothing fires during form move unless the form is repainted.</p>
  
  <p>Thank you </p>
  
  <p>Current code is in VB but I can handle both.</p>