我测试有效
全局代码
Public Sub OwnDrawBorder(ByRef panel As WinForm.Panel)
Dim panelBase As windows.forms.Panel = panel.BaseControl
AddHandler panelBase.Paint, AddressOf Panel_DrawBorder
msgbox(123)
End Sub
Public Sub Panel_DrawBorder(sender As Object, e As windows.forms.PaintEventArgs)
Dim panel As windows.forms.Panel = sender
Const width As Integer = 1
windows.forms.ControlPaint.DrawBorder( _
e.Graphics, panel.ClientRectangle, _
Color.FromArgb(111, 157, 217), width, Windows.Forms.ButtonBorderStyle.Solid, _
Color.FromArgb(111, 157, 217), width, Windows.Forms.ButtonBorderStyle.Solid, _
Color.FromArgb(111, 157, 217), width, Windows.Forms.ButtonBorderStyle.Solid, _
Color.FromArgb(111, 157, 217), width, Windows.Forms.ButtonBorderStyle.Solid _
)
output.show(Date.now)
End Sub
绑定事件
OwnDrawBorder(e.Form.controls("panel1"))
刷新调用pain事件
Dim a = Forms("窗口1").controls("panel1").basecontrol
a.refresh