У меня проблемы с удалением старых строк после ControlPaint.DrawReversibleLine и DrawReversibleFrame.Я удалил, но screen (usercontrol и picturebox) сохраняет старые строки, пока Mouse_Move.Как полностью стереть старые строки?
Я искал такие вещи в stackoverflow, все ответы похожи, но не работают для моего случая.
//a picturebox1 on usercontrol.
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
//...other code
ControlPaint.DrawReversibleLine(HorizontalSelectionPT1, HorizontalSelectionPT2, Color.Red); //erase old Horizontal line
ControlPaint.DrawReversibleLine(VerticalSelectionPT1, VerticalSelectionPT2, Color.Red); //erase old vertical line
Point point = PointToScreen(base.Location);
HorizontalSelectionPT1 = new Point(point.X, Cursor.Position.Y);
HorizontalSelectionPT2 = new Point(point.X + base.Width, Cursor.Position.Y);
VerticalSelectionPT1 = new Point(Cursor.Position.X, point.Y);
VerticalSelectionPT2 = new Point(Cursor.Position.X, point.Y + base.Height);
ControlPaint.DrawReversibleLine(HorizontalSelectionPT1, HorizontalSelectionPT2, Color.Red); //Draw new line
ControlPaint.DrawReversibleLine(VerticalSelectionPT1, VerticalSelectionPT2, Color.Red); //Draw new line
//draw selected frame
ControlPaint.DrawReversibleFrame(pbCanvas.RectangleToScreen(rectangle_0), Color.Black, FrameStyle.Dashed); //erase old frame
rectangle_0.Width = e.X - rectangle_0.X;
rectangle_0.Height = e.Y - rectangle_0.Y;
ControlPaint.DrawReversibleFrame(pbCanvas.RectangleToScreen(rectangle_0), Color.Black, FrameStyle.Dashed); //Draw new frame
//...other codes
}
Вряд ли, чтобы сделать снимок экрана, я использовал Camera.![enter image description here](https://i.stack.imgur.com/3qfI7.jpg)