title: Capturing screen properly works only in certain taskbar status
body: <p>I'm working on a program loading an image or capturing a screen area and convert them to simulate color blinds' vision.</p>
  
  <p>The problem I've encountered now is that capturing algorithm doesn't work in different taskbar status that I wrote the code in.</p>
  
  <p>The taskbar of my computer is set up to the top of the screen, and it's locked. I wrote the code in that status, and I realized that the program doesn't work on other computers with different taskbar status. I unlocked it or moved it to the other sides of the screen and it didn't work in the way as I wanted.</p>
  
  <p>To capture a screen area, an opaque form is opened by the main one, and area to be captured is calculated from the position of mouse when its left button is pressed and released.</p>
  
  <p>Also the position of mouse is shown by a label keeping following the cursor while it is hovering on the form. The label stops following the cursor while I'm pressing the left button.</p>
  
  <p>I have no ides why it works like this.. Does any part of my code is affected by taskbar status? Appreciate in advance! The code is copied below.</p>
  
  <pre><code>public partial class Form_Capture_Rect : Form
  {
      //CaptureRectangular is the name of this form
      private void CaptureRectangular_Load(object sender, EventArgs e)
      {
          int width = Screen.PrimaryScreen.Bounds.Width;
          int height = Screen.PrimaryScreen.Bounds.Height;
          this.FormBorderStyle = FormBorderStyle.None;
          this.Size = new System.Drawing.Size(width, height);
  
          Message_Capture.Left = (width - Message_Capture.Width) / 2;
  
          Message_Capture.Location = new System.Drawing.Point((width - Message_Capture.Width) / 2, (height - Message_Capture.Height) / 2);
      }
  
      //src: position the left button of mouse is pressed
      //dest: position it is released
      //leftTop: gets smaller value from src and dest, X and Y respectively
      //width, height: size of the captured image
      int srcX, srcY;
      int destX, destY;
      int leftTopX, leftTopY;
      int width, height;
  
      //gets position of mouse when its left button is pressed
      private void Form_Capture_MouseDown(object sender, MouseEventArgs e)
      {
          srcX = Cursor.Position.X;
          srcY = Cursor.Position.Y;
          //this.WindowState = FormWindowState.Minimized;
      }
  
      private void Form_Capture_MouseUp(object sender, MouseEventArgs e)
      {
          //the captured image will be shown onto a picturebox 'Pic_Unchanged' of the main form
          Form_Main mainForm = Application.OpenForms["Form_Main"] as Form_Main;
          PictureBox Pic_Unchanged = mainForm.Controls["Pic_Unchanged"] as PictureBox;
  
          //gets the position of mouse when it's released
          destX = Cursor.Position.X;
          destY = Cursor.Position.Y;
  
          //when its width or height is zero, the function is terminated
          if (srcX == destX || srcY == destY)
          {
              mainForm.WindowState = FormWindowState.Normal;
              this.WindowState = FormWindowState.Minimized;
              this.Close();
          }
          else
          {
              //calculate out these for values to get image
              leftTopX = srcX &lt; destX ? srcX : destX;
              leftTopY = srcY &lt; destY ? srcY : destY;
              width = srcX &lt; destX ? destX - srcX : srcX - destX;
              height = srcY &lt; destY ? destY - srcY : srcY - destY;
  
              Graphics myGraphics = this.CreateGraphics();
              Bitmap memoryImage = new Bitmap(width, height, myGraphics);
              Graphics memoryGraphics = Graphics.FromImage(memoryImage);
  
              //copies image
              mainForm.WindowState = FormWindowState.Normal;
              this.WindowState = FormWindowState.Minimized;//whithout this, the form will be captured
              memoryGraphics.CopyFromScreen(leftTopX, leftTopY, 0, 0, new Size(width, height));
  
              //show the captured image onto the picturebox
              Pic_Unchanged.Image = memoryImage;
  
              this.Close();
          }
      }
  
      //shows the position of mouse with a label following cursor
      //MouseLoc is a label
      private void Form_Capture_Rect_MouseMove(object sender, MouseEventArgs e)
      {
          MouseLoc.Location = new System.Drawing.Point(Cursor.Position.X, Cursor.Position.Y);
          MouseLoc.Text = e.X + ", " + e.Y;
      }
  
      //Delete a text 'Message_Capture' which says "Capture Area" 2.5 seconds after the form is shown up
      private void DeleteMessage_Tick(object sender, EventArgs e)
      {
          Message_Capture.Visible = false;
      }
  }
  </code></pre>