title: Force redraw before long running operations
body: <p>When you have a button, and do something like:</p>
  
  <pre><code>Private Function Button_OnClick
  
      Button.Enabled = False
  
      [LONG OPERATION] 
  
  End Function
  </code></pre>
  
  <p>Then the button will not be grayed, because the long operation prevents the UI thread from repainting the control. I know the right design is to start a background thread / dispatcher, but sometimes that's too much hassle for a simple operation.</p>
  
  <p>So how do I force the button to redraw in disabled state? I tried .UpdateLayout() on the Button, but it didn't have any effects. I also tried System.Windows.Forms.DoEvents() which normally works when using WinForms, but it also had no effect.</p>