C # realize history

Requirements: in image processing software development process, it is necessary to withdraw the previous step;

Solution: Save the results of each step to the global list, you can read at the time of withdrawal;


List<Bitmap> list_bmp = new List<Bitmap>();
        private void button1_Click(object sender, EventArgs e)
        {
             list_bmp.Add(threshImge.ToBitmap());
        }

        private void button2_Click(object sender, EventArgs e)
        {
             list_bmp.Add(threshImge.ToBitmap());
        }
        private void button8_Click(object sender, EventArgs e)
        {
            Bitmap bmp = list_bmp.ElementAt(list_bmp.Count-1);
            list_bmp.RemoveAt(list_bmp.Count - 1);
            pictureBox2.Image = bmp;
        }



Published 117 original articles · won praise 4 · views 80000 +

Guess you like

Origin blog.csdn.net/qq_36266449/article/details/78384016