求教在 Protected Overrides Sub OnKeyDown(e As KeyEventArgs)怎么重绘控件部分,多谢!

求教在 Protected Overrides Sub OnKeyDown(e As KeyEventArgs)如何重绘控件部分,谢谢!!! 求教在 Protecte

求教在 Protected Overrides Sub OnKeyDown(e As KeyEventArgs)如何重绘控件部分,谢谢!!!
 
求教在 Protected Overrides Sub OnKeyDown(e As KeyEventArgs)如何重绘控件部分,谢谢!!!



Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        MyBase.OnPaint(e)
        Me.DoubleBuffered = True
        e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
        PaintBackground(e.Graphics, ClientRectangle)
 pich(FocusRows, g)
End Sub
 Protected Overridable Sub PaintBackground(g As Graphics, bounds As Rectangle)
        Dim BackColor As Color = If((Me.Parent IsNot Nothing), Parent.BackColor, AppColors.ControlColor)
        Dim BorderColor As Color = AppColors.HighlightColor
        Using BackBrush As New SolidBrush(Color.Gray)
            g.FillRectangle(Brushes.DarkGray, bounds)
        End Using

        Using BorderPen As New Pen(Brushes.Black) '(BorderColor)
            g.DrawRectangle(BorderPen, New Rectangle(bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1))
        End Using
    End Sub
 Protected Overrides Sub OnKeyDown(e As KeyEventArgs)
        MyBase.OnKeyDown(e)
        我想在这里给控件画一个矩形,执行pich,求教改如何画,谢谢!!!
    End Sub

 Private Sub pich(ByVal a As Short, g As Graphics)
             g.FillRectangle(New SolidBrush(Color.FromArgb(&H71EB2000)), 0, a * 18, Me.Width, 18)        
           Me.Refresh()
    End Sub

[解决办法]
别在这,在OnPaint中处理,key事件中调用Invalidate
[解决办法]
e.Handled=true
  
*****************************************************************************
http://feiyun0112.cnblogs.com/