Vb.net 使用DrawRect或DrawBorder时,防止过度缠绕线绘制
代码如下所示 当我调整大小时,尤其是调整大小以增加宽度时,绘制的线条仍然保留 即使我用纯色清除了e.图形,问题仍然存在 有什么简单的方法可以防止这种情况发生吗Vb.net 使用DrawRect或DrawBorder时,防止过度缠绕线绘制,vb.net,winforms,visual-studio-2010,visual-studio,Vb.net,Winforms,Visual Studio 2010,Visual Studio,代码如下所示 当我调整大小时,尤其是调整大小以增加宽度时,绘制的线条仍然保留 即使我用纯色清除了e.图形,问题仍然存在 有什么简单的方法可以防止这种情况发生吗 谢谢大家! 在面板的构造函数中使用以下内容尝试在调整大小事件上无效: Private Sub pancontrols_Paint(sender As Object, e As PaintEventArgs) Handles pancontrols.Paint e.Graphics.Clear(Color.Yellow)
谢谢大家! 在面板的构造函数中使用以下内容尝试在调整大小事件上无效:
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
Public Sub New()
Me.DoubleBuffered = True
Me.ResizeRedraw = True
End Sub