//General functions:
 private void btnOpenFile_Click(object sender, EventArgs e)
 {
     try
     {
         string fileName = OpenImage();
         if (fileName == "fail")
         {
             return;
         }
         Bitmap mainBitMap = new Bitmap(fileName, true);
         mainImage        = new MainImage(fileName, mainBitMap);
         picBoxMain.Image = mainImage.imageBitMap;
         mainImage.GetHistogram();
         DrawHistogram();
         mainHistogram.Visible   = true;
         tabCtrlLab.Visible      = true;
         cbAlreadyChosen.Enabled = false;
         TwoPointOperation       = TwoPointOpWithDialog;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Exception");
     }
 }
 private void InvalidateImage()
 {
     mainImage.GetHistogram();
     this.Invoke(new Action(() => DrawHistogram()));
     picBoxMain.Image = mainImage.imageBitMap;
 }