以下の方法を使用して、Picturebox にカスタム選択四角形を描画しようとしています。
    void _drag_UpdateView(bool clearOnly, MouseEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("UpdateView");
        using (Graphics g = this.i_rendered.CreateGraphics())
        {
            g.Clear(Color.Transparent);
            if (clearOnly)
                return;
            int px = (_drag_start.X > e.Location.X)?e.Location.X:_drag_start.X;
            int py = (_drag_start.Y > e.Location.Y)?e.Location.Y:_drag_start.Y;
            if (px < 0)
                px = 0;
            if (py < 0)
                py = 0;
            int wx = Math.Abs(e.Location.X-_drag_start.X);
            int wy = Math.Abs(e.Location.Y-_drag_start.Y);
            g.DrawRectangle(Pens.LightBlue, px, py, wx, wy);
        }
    }
私が電話するたびに:
g.Clear(Color.Transparent);
ピクチャーボックス全体が黒くなります。ただし、長方形はその上に描画されます。もちろん、そのメソッドを呼び出さないと、四角形はそれ自体に積み重なります。古い長方形を削除して、このような新しい長方形を作成したいと思います。
誰が何が悪いのか説明できますか?