All the good time! Is it possible to clear the pictureBox from the drawn Image so that only those Image objects with which .Tag matches the .Tag of the currently created (drawn) Image would be cleared? The bottom line is that in the background image (shirt) there are parts (collar, pocket, cuff ect) in different styles. Such designer clothes. Now the problem is that the already drawn is superimposed on a new one, it turns out 4 collars, 3 pockets in one place ect. Can I clean them up before adding a new one? Should I use the Tag or eat another way?
private void onRBstyleClick(object sender, MouseEventArgs e) { RadioButton _rb = sender as RadioButton; string fileName = _rb.Text; string path = $"styles/shirt/{fileName}.png"; try { Image im = Image.FromFile(path); im.Tag = _rb.Tag; Graphics gr = pbx_StylePic.CreateGraphics(); gr.DrawImage(im, new Point(0, 0)); } catch (System.IO.FileNotFoundException) { MessageBox.Show("Картинка не найдена"); } } It only comes to mind to edit the drawings themselves so that they overlap and close each other in the right places. But is there any other way?