全局代码
Public Sub panel_Paint(sender As Object, e As windows.forms.PaintEventArgs)
windows.forms.ControlPaint.DrawBorder(e.Graphics, sender.ClientRectangle, Color.White, 10, windows.forms.ButtonBorderStyle.Solid, Color.White, _
10, windows.forms.ButtonBorderStyle.Solid, Color.DimGray, 10, windows.forms.ButtonBorderStyle.Solid, Color.DimGray, _
10, windows.forms.ButtonBorderStyle.Solid)
End Sub
绑定事件
Dim p As windows.forms.panel = e.form.controls("panel1").basecontrol
addhandler p.paint, addressof panel_paint
p.refresh