예제 #1
0
        /*******************    Redo Undo Features    ******************/
        #region Redo Undo
        private void Undo_Button_Click(object sender, EventArgs e)
        {
            _redoStack.Push(_undoStack.Pop());
            Redo_Button.Enabled = true;

            bmp = new Bitmap(_undoStack.Peek());
            g   = Graphics.FromImage(bmp);
            PictureBox1.Image = bmp;
            PictureBox1.Refresh();

            Undo_Button.Enabled = !(_undoStack.Count == 1);
        }
예제 #2
0
        private void ResetPictureBox()
        {
            FileName          = "";
            bmp               = new Bitmap(PictureBox1.Width, PictureBox1.Height);
            g                 = Graphics.FromImage(bmp);
            PictureBox1.Image = bmp;
            PictureBox1.Refresh();

            _undoStack.Clear();
            _redoStack.Clear();
            Undo_Button.Enabled = false;
            Redo_Button.Enabled = false;
            isNewButtonClicked  = false;

            _undoStack.Push(new Bitmap(bmp));
        }
예제 #3
0
        private void PictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                if (txtcrp == true)
                {
                    Brush brush = new SolidBrush(myColor);
                    using (Graphics g = Graphics.FromHwnd(PictureBox1.Handle))
                    {
                        using (myFontf)
                        {
                            g.DrawString(textBox1.Text, myFontf, brush, new PointF(e.X, e.Y));
                        }
                    }
                    txtcrp = true;
                }


                else if (txtcrp == false)
                {
                    Cursor = Cursors.Default;
                    if (Makeselection)
                    {
                        try
                        {
                            if (e.Button == System.Windows.Forms.MouseButtons.Left)
                            {
                                Cursor = Cursors.Cross;
                                cropX  = e.X;
                                cropY  = e.Y;

                                cropPen           = new Pen(Color.Black, 1);
                                cropPen.DashStyle = DashStyle.DashDotDot;
                            }
                            PictureBox1.Refresh();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Error " + ex);
                        }
                    }
                    txtcrp = false;
                }
            }
            catch (Exception ex) { }
        }
        void ofd_FileOkWGSSwitched(object sender, CancelEventArgs e)
        {
            OpenFileDialog ofd = sender as OpenFileDialog;

            try
            {
                activeParcour = Importer.importFromDxfWGSSwitched(ofd.FileName);
                PictureBox1.SetParcour(activeParcour);
                PictureBox1.Invalidate();
                PictureBox1.Refresh();
                fldName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error while Parsing File");
            }
        }
예제 #5
0
		private void Timer2_Tick(object sender, System.EventArgs e)
		{
			int left = 0;
			int right = 0;

			if (FFTEnabled.Checked)
			{
				PictureBox1.Refresh();
			}

			//Dim leftamplitude(512) As Integer
			//player.GetFFTValues(1024, ZPlay.TFFTWindow.fwBartlett, Nothing, Nothing, leftamplitude, Nothing, Nothing, Nothing)
			//leftvu.Value = leftamplitude(1)

			player.GetVUData(ref left, ref right);
			leftvu.Value = left;
			rightvu.Value = right;

		}
예제 #6
0
        private void PictureBox1_MouseMove_1(object sender, MouseEventArgs e)
        {
            if (txtcrp == true)
            {
                Brush brush = new SolidBrush(myColor);
                using (Graphics g = Graphics.FromHwnd(PictureBox1.Handle))
                {
                    using (myFontf)
                    {
                        g.DrawString(textBox1.Text, myFontf, brush, new PointF(e.X, e.Y));
                    }
                }
                txtcrp = true;
            }
            else if (txtcrp == false)
            {
                Cursor = Cursors.Default;
                if (Makeselection)
                {
                    try
                    {
                        if (PictureBox1.Image == null)
                        {
                            return;
                        }


                        if (e.Button == System.Windows.Forms.MouseButtons.Left)
                        {
                            PictureBox1.Refresh();
                            cropWidth  = e.X - cropX;
                            cropHeight = e.Y - cropY;
                            PictureBox1.CreateGraphics().DrawRectangle(cropPen, cropX, cropY, cropWidth, cropHeight);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error : " + ex);
                    }
                }
                txtcrp = false;
            }
        }
예제 #7
0
        private void OpenFile(object sender, EventArgs e, bool isRecentFileClicked)
        {
            if (!isRecentFileClicked)
            {
                FileName = openFileDialog1.FileName;
            }
            using (imageFile = Image.FromFile(FileName))
            {
                _undoStack.Clear();
                _redoStack.Clear();
                bmp = new Bitmap(imageFile);
                g   = Graphics.FromImage(bmp);
                PictureBox1.Image = bmp;
                PictureBox1.Refresh();
                _undoStack.Push(new Bitmap(bmp));

                Undo_Button.Enabled = false;
                Redo_Button.Enabled = false;
                SaveRecentFilesToolStripMenuItem(sender, e);
            }
        }
예제 #8
0
        private void PictureBox1_MouseMove_1(object sender, MouseEventArgs e)
        {
            if (TabControl1.SelectedIndex == 4)
            {
                Point TextStartLocation = e.Location;
                if (CreateText)
                {
                    Cursor = Cursors.IBeam;
                }
            }
            else
            {
                Cursor = Cursors.Default;
                if (Makeselection)
                {
                    try
                    {
                        if (PictureBox1.Image == null)
                        {
                            return;
                        }


                        if (e.Button == System.Windows.Forms.MouseButtons.Left)
                        {
                            PictureBox1.Refresh();
                            cropWidth  = e.X - cropX;
                            cropHeight = e.Y - cropY;
                            PictureBox1.CreateGraphics().DrawRectangle(cropPen, cropX, cropY, cropWidth, cropHeight);
                        }
                    }
                    catch (Exception ex)
                    {
                        //if (ex.Number == 5)
                        //    return;
                    }
                }
            }
        }