title: Screen capturing is not working when windows form is invisible
body: <p>The following program does not capture the screen when I am running the form invisible. timer is started in form load event.</p>
  
  <p>Is there any way to make this program to capture screen in form invisible mode. Please help me to sort out this problem. Thanks   </p>
  
  <pre><code>Private keepInvisible As Boolean
  
  Public Sub New()
  
      InitializeComponent()
      keepInvisible = True
  End Sub
  
  Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
      keepInvisible = False
  
  
      Dim ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
      Dim screenGrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
      Using g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenGrab)
          g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)
      End Using
  
      screenGrab = New Bitmap(screenGrab, 800, 600) 'Defines the new image size
  
      Dim Filename As String
      Filename = Format(Now, "dd-MM-yyyy hh-mm-ss tt") 'I want the date to be the name of the image
  
      screenGrab.Save(Application.StartupPath &amp; "/" &amp; Filename &amp; ".Jpeg", Imaging.ImageFormat.Jpeg)
  End Sub
  
  Protected Overrides Sub SetVisibleCore(ByVal value As Boolean)
      If keepInvisible Then
          MyBase.SetVisibleCore(False)
      Else
          MyBase.SetVisibleCore(value)
      End If
  End Sub
  </code></pre>