0

I use this.Invalidate(); clear but all clear. I need clear only that I drew earlier.

            private void AfyTextBox_Paint(object sender, PaintEventArgs e)
        {

            if (afytransparentTextBox.BackColor.A != 255 || afytransparentTextBox.BackColor.B != 255 || afytransparentTextBox.BackColor.G != 255 || afytransparentTextBox.BackColor.R != 255)
            {
                path = RoundedRectangle.Create(1, 1, this.Width - 7, this.Height - 7, 2); // Draw around
                e.Graphics.DrawPath(new Pen(afytransparentTextBox.BackColor), path);
            }
            else
            {
                //Here I need to clean that I drew earlier.( Draw around)
            }
}
adolfy
  • 9
  • 3

2 Answers2

0

You can try this method:

Graphics.Clear();

coder
  • 13,002
  • 31
  • 112
  • 214
0

You cannot 'undraw' from a surface. You have to clear and repaint what you want to appear. It is usually enough to tell the component to repaint itself using the Invalidate method. You could have a boolean flag to control whether your temporary overlay box is painted or not.

Paul Ruane
  • 37,459
  • 12
  • 63
  • 82