Visual Basic > Forms
Changing the way a form is repainted while being resized-dragged
Changing the way a form is repainted while being resized-dragged The following code changes the way in which Windows handles the screen updating for dragging and resizing of forms: Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long 'Purpose : Determines if full window drag is enabled (i.e. when dragging a window does ' the screen show an outline of the window or the window itself). 'Inputs : N/A 'Outputs : Returns True if full window drag is enabled. 'Notes : Affects dragging/resize of all windows on this machine Function WindowDragFullOn() As Boolean Const SPI_GETDRAGFULLWINDOWS = 38 Dim lRetVal As Long If CBool(SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0&, lRetVal, 0&)) Then 'Feature supported If lRetVal = 0 Then 'Feature disabled WindowDragFullOn = False Else 'Feature enabled WindowDragFullOn = True End If Else 'Feature not supported. WindowDragFullOn = False End If End Function 'Purpose : Enables/disables the full window drag 'Inputs : Enabled If True enables full window dragging. 'Outputs : Returns True if successfully set value. 'Notes : Affects all windows on this machine Function WindowDragFull(Enabled As Boolean) As Boolean Const SPI_SETDRAGFULLWINDOWS = 37 Const SPIF_SENDWININICHANGE = 2 If Enabled Then 'Enable full window drag. WindowDragFull = SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1&, ByVal vbNullString, SPIF_SENDWININICHANGE) Else 'Disable full window drag. WindowDragFull = SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0&, ByVal vbNullString, SPIF_SENDWININICHANGE) End If End Function 'Demonstration routine 'Swaps the state of the full window dragging Sub Test() If WindowDragFullOn Then WindowDragFull False Else WindowDragFull True End If End Sub
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows