private void biLinearToolStripMenuItem_Click(object sender, EventArgs e) { if (img == null) // verify if the image is already opened { return; } Cursor = Cursors.WaitCursor; // clock cursor //copy Undo Image imgUndo = img.Copy(); InputBox formz = new InputBox("Zoom (factor)?"); formz.ShowDialog(); string factorZ = formz.ValueTextBox.Text; bool successc = float.TryParse(factorZ, out float j); if (successc && j > 0) { ImageClass.Scale_Bilinear(img, imgUndo, j); ImageViewer.Image = img.Bitmap; ImageViewer.Refresh(); // refresh image on the screen Cursor = Cursors.Default; // normal cursor } else { MessageBox.Show("Value for Zoom must be a number bigger than zero.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // for Error } }
private void zoomBilinearToolStripMenuItem_Click(object sender, EventArgs e) { if (img == null) // verify if the image is already opened { return; } Cursor = Cursors.WaitCursor; // clock cursor //copy Undo Image imgUndo = img.Copy(); InputBox form = new InputBox("Qual o valor de Zoom?"); form.ShowDialog(); float scaleFactor = (float)Convert.ToDecimal(form.ValueTextBox.Text); ImageClass.Scale_Bilinear(img, imgUndo, scaleFactor); ImageViewer.Image = img.Bitmap; ImageViewer.Refresh(); // refresh image on the screen Cursor = Cursors.Default; // normal cursor }