title: How do you allow a vb.net basic winforms control to detect clicking outside of the control
body: <p>How do I know when I click away from a control?  I can do so much with the control when a user clicks it but I can't figure out how to detect that the user is no longer 'using' the object.  I simply want to turn on/off events and/or update certain properties when the user clicks outside of the Custom Text Object my application has built into it.</p>
  
  <p><strong>The Story</strong>: I am adding custom text object controls to a form dynamically at runtime.  I have coded into the custom text control a few events using 'AddHandler'.  The events I've added to the object which are then available at runtime are:</p>
  
  <p>MouseMove</p>
  
  <p>MouseDown</p>
  
  <p>MouseDoubleClick</p>
  
  <p>These are all working great as I can use these events to determine what text control is being clicked and therefore use the information gathered by these events to then move the control anywhere on the form.</p>
  
  <p>In order to 'Edit' the text of the text box the user Double Clicks the text box. 
   I need to do this as I need to Turn Off the MouseMove event so that the user can then type into the text box and highlight/copy/paste text in/out of the thext box.  All of this works great.</p>
  
  <p>The issue I am having now is <strong>turning the MouseMove event back On</strong>.  So say the user is done entering text into the text control.  I need to know when the user clicks outside of the control so I can then reactivate the MouseMove Event and then update other Properties of the text control such as back color, readOnly etc...  Basically this functionality gives the user access to edit or move the object aka editMode.  </p>
  
  <p>My first attempt was to use txtCtrl.LostFocus() event however this doesn't always catch and would force me to have to write in a Focus() method for each and every other control within the application to Force focus on to an object other then the Custom Text Control the user is currently interacting with.  </p>
  
  <p>How do I accomplish this with any events other then the Focus methods/events.  Are there other options/functions to do what I'm imagining should be possible?</p>
  
  <p>Example Screenshot skeleton Form:
  <a href="https://i.stack.imgur.com/YwWdw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YwWdw.png" alt="enter image description here"></a></p>