110,539
社区成员
发帖
与我相关
我的任务
分享
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
Protected Overrides Sub WndProc(ByRef m As Message)
Select Case m.Msg
Case &H5
' 为避免加载窗体或还原窗体时绘制出现黑框,处理Windows消息
'change size: WM_SIZE
If True Then
Dim newState As FormWindowState = FormWindowState.Normal
Select Case m.WParam.ToInt32()
Case 0
'SIZE_RESTORED
Me.Timer1.Enabled = True
Case 1
'SIZE_MINIMIZED
Me.Opacity = 0
Case 2
'SIZE_MAXIMIZED
Case Else
Exit Select
End Select
End If
Exit Select
Case Else
Exit Select
End Select
MyBase.WndProc(m)
End Sub
protected override void WndProc(ref Message m)
{
const int WM_PAINT = 0xF;
switch (m.Msg)
{
case WM_PAINT:
return;
}
base.WndProc(ref m);
}