예제 #1
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int Dx, Dy;

            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }

            TranslationBox frame = new TranslationBox();

            frame.ShowDialog();
            Cursor = Cursors.WaitCursor; // cursor relogio
            try
            {
                Dx = Int32.Parse(frame.DxTextBox.Text);
                Dy = Int32.Parse(frame.DyTextBox.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Please insert integer values!");
                Cursor = Cursors.Default; // cursor normal
                return;
            }

            //copy Undo Image
            imgUndo = img.Copy();
            DateTime d1 = DateTime.Now;

            ImageClass.Translation(imgUndo, img, Dx, Dy);

            ImageViewer.Refresh(); // atualiza imagem no ecrã
            DateTime d2 = DateTime.Now;

            Cursor = Cursors.Default; // cursor normal
            MessageBox.Show((d2 - d1).ToString());
        }
예제 #2
0
파일: MainForm.cs 프로젝트: jmdbo/SS
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int Dx, Dy;

            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
                return;

            TranslationBox frame = new TranslationBox();
            frame.ShowDialog();
            Cursor = Cursors.WaitCursor; // cursor relogio
            try
            {
                Dx = Int32.Parse(frame.DxTextBox.Text);
                Dy = Int32.Parse(frame.DyTextBox.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Please insert integer values!");
                Cursor = Cursors.Default; // cursor normal
                return;
            }

            //copy Undo Image
            imgUndo = img.Copy();
            DateTime d1 = DateTime.Now;

            ImageClass.Translation(imgUndo, img, Dx, Dy);

            ImageViewer.Refresh(); // atualiza imagem no ecrã
            DateTime d2 = DateTime.Now;
            Cursor = Cursors.Default; // cursor normal
            MessageBox.Show((d2 - d1).ToString());
        }