Advertisement
4_2005-2006 Custom Controls/ Forms/ Menus #167484

Move Controls Smoothly w/ Mouse (Runtime)

This code demostrates how to move controls smoothly on a form without them redrawing slowly or chunky looking.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'Copy this code into a form, and add a picturebox
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
 If Button = vbLeftButton Then
  ReleaseCapture
  Call SendMessage(Picture1.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
 End If
End Sub
Original Comments (3)
Recovered from Wayback Machine