2014-01-24 18 views
1

enter image description here防止使用的drawRect或DrawBorder

Private Sub pancontrols_Paint(sender As Object, e As PaintEventArgs) Handles pancontrols.Paint 

    e.Graphics.Clear(Color.Yellow) 
    Dim borderWidth As Integer = 1 
    Dim theColor As Color = Color.Gray 
    ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, theColor, borderWidth, ButtonBorderStyle.Solid, theColor, borderWidth, ButtonBorderStyle.Solid, theColor, borderWidth, ButtonBorderStyle.Solid, theColor, borderWidth, ButtonBorderStyle.Solid) 
    MyBase.OnPaint(e) 
End Sub 

代碼是像上面當在包裹的畫線。

當我調整大小,尤其是調整大小以增加寬度時,畫線仍然存在。

即使我用純色清除e.Graphics,問題仍然存在。

有沒有簡單的方法來防止這種情況?

謝謝!

回答

0

嘗試無效的調整大小事件與此在面板的構造函數:

Public Sub New() 
    Me.DoubleBuffered = True 
    Me.ResizeRedraw = True 
End Sub