This commit is contained in:
JenneJ
2016-06-01 15:21:19 +02:00
parent a3bbbfa570
commit a434c83191
4 changed files with 56 additions and 23 deletions

View File

@@ -416,4 +416,30 @@
End Class
Public Class PerfomanceHelper
<Runtime.InteropServices.DllImport("user32.dll")> _
Public Shared Function SendMessage(hWnd As IntPtr, msg As Int32, wParam As Boolean, lParam As Int32) As Integer
End Function
Private Const WM_SETREDRAW As Int32 = &HB
''' <summary>
''' Verhindert Draw-Events. Am Ende sollte ResumeDraw `aufgerufen` werden.
''' </summary>
''' <param name="c"></param>
''' <remarks></remarks>
Public Shared Sub SuspendDraw(c As Control)
SendMessage(c.Handle, WM_SETREDRAW, False, 0)
End Sub
''' <summary>
''' Lässt die Draw-Events wieder zu. Davor sollte `SuspendDraw` aufgerufen werden
''' </summary>
''' <param name="c"></param>
''' <remarks></remarks>
Public Shared Sub ResumeDraw(c As Control)
SendMessage(c.Handle, WM_SETREDRAW, True, 0)
c.Refresh()
End Sub
End Class
End Module