Option Explicit Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Const GWL_STYLE = (-16) Const WS_THICKFRAME = &H40000 Const SWP_NOSIZE = &H1 Const SWP_NOMOVE = &H2 Const SWP_NOZORDER = &H4 Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE Const SWP_DRAWFRAME = SWP_FRAMECHANGEDPrivate Sub Form_Load() Picture1.Align = vbAlignLeft SetWindowLong Picture1.hwnd, GWL_STYLE, _ GetWindowLong(Picture1.hwnd, GWL_STYLE) Or WS_THICKFRAME SetWindowPos Picture1.hwnd, hwnd, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME End Sub
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const GWL_STYLE = (-16)
Const WS_THICKFRAME = &H40000
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOZORDER = &H4
Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
Const SWP_DRAWFRAME = SWP_FRAMECHANGEDPrivate Sub Form_Load()
Picture1.Align = vbAlignLeft
SetWindowLong Picture1.hwnd, GWL_STYLE, _
GetWindowLong(Picture1.hwnd, GWL_STYLE) Or WS_THICKFRAME
SetWindowPos Picture1.hwnd, hwnd, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME
End Sub