Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 使用DrawRect或DrawBorder时,防止过度缠绕线绘制_Vb.net_Winforms_Visual Studio 2010_Visual Studio - Fatal编程技术网

Vb.net 使用DrawRect或DrawBorder时,防止过度缠绕线绘制

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)

代码如下所示

当我调整大小时,尤其是调整大小以增加宽度时,绘制的线条仍然保留

即使我用纯色清除了e.图形,问题仍然存在

有什么简单的方法可以防止这种情况发生吗


谢谢大家!

在面板的构造函数中使用以下内容尝试在调整大小事件上无效:

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