我想在treeview 中拖动节点,同时在目标节点下方划一条线,表示插入的地方,下移的时候正常,但是上移,之前的线并不会清除,而是残留了下来,有一定几率控件自动刷新帮我清除,这是怎么一回事呢??代码如下:private void SwapBuffers(Image BackBuffer, Graphics FrontBuffer)
        {
            FrontBuffer.DrawImage(BackBuffer, 0, 0);
            FrontBuffer.Flush(System.Drawing.Drawing2D.FlushIntention.Sync);
        }        private void LayersTree_DragOver(object sender, DragEventArgs e)
        {
            Point pt;
            LayerNode tmpNode;
            pt = ((TreeView)(sender)).PointToClient(new Point(e.X, e.Y));
            tmpNode = this.GetNodeAt(pt) as LayerNode;
            this.SelectedNode = tmpNode;            #region 自绘画线
            if (tmpNode == null)
            {
                LayerNode firstNode = this.Nodes[0] as LayerNode;  //LayerNode是TreeNode的派生类                if (pt.Y < firstNode.Bounds.Top)
                {
                    m_pLeft = new Point(this.Left, firstNode.Bounds.Top);
                    m_pRight = new Point(this.Width, firstNode.Bounds.Top);
                }
                else
                {
                    LayerNode lastNode = this.Nodes[this.Nodes.Count - 1] as LayerNode;
                    m_pLeft = new Point(this.Left, lastNode.Bounds.Top + lastNode.Bounds.Height);
                    m_pRight = new Point(this.Width, lastNode.Bounds.Top + lastNode.Bounds.Height);
                }
            }
            else
            {
                m_pLeft = new Point(this.Left, tmpNode.Bounds.Top + tmpNode.Bounds.Height );
                m_pRight = new Point(this.Width, tmpNode.Bounds.Top + tmpNode.Bounds.Height);
            }            Graphics m_FrontGBuffer = this.CreateGraphics();
            Image m_MidBuffer = new Bitmap(m_BackBuffer.Width, m_BackBuffer.Height);    //m_BackBuffer是Image,在鼠标点下的时候获取当前的背景图
            Graphics LocalDraw = Graphics.FromImage(m_MidBuffer);
            SwapBuffers(m_BackBuffer, LocalDraw);            Pen pen = new Pen(Color.Blue);
            pen.Width = 1;            //draw a horizontal line                
            LocalDraw.DrawLine(pen, m_pLeft, m_pRight);            SwapBuffers(m_MidBuffer, m_FrontGBuffer);
            m_MidBuffer.Dispose();
            m_MidBuffer = null;
            #endregion             
        }