Private Declare Function Rectangle Lib "gdi32" (ByVal hDC As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function CreateDCAsNull Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any, lpInitData As Any) As Long
Private Declare Function SetROP2 Lib "gdi32" (ByVal hDC As Long, ByVal nDrawMode As Long) As Long
Private Const R2_BLACK = 1 ' 0
Private Const R2_COPYPEN = 13 ' P
Private Const R2_LAST = 16
Private Const R2_MASKNOTPEN = 3 ' DPna
Private Const R2_MASKPEN = 9 ' DPa
Private Const R2_MASKPENNOT = 5 ' PDna
Private Const R2_MERGENOTPEN = 12 ' DPno
Private Const R2_MERGEPEN = 15 ' DPo
Private Const R2_MERGEPENNOT = 14 ' PDno
Private Const R2_NOP = 11 ' D
Private Const R2_NOT = 6 ' Dn
Private Const R2_NOTCOPYPEN = 4 ' PN
Private Const R2_NOTMASKPEN = 8 ' DPan
Private Const R2_NOTMERGEPEN = 2 ' DPon
Private Const R2_NOTXORPEN = 10 ' DPxn
Private Const R2_WHITE = 16 ' 1
Private Const R2_XORPEN = 7 ' DPx
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Sub ClipCursorRect Lib "user32" Alias "ClipCursor" (lpRect As RECT)
Private Declare Sub ClipCursorClear Lib "user32" Alias "ClipCursor" (ByVal lpRect As Long)
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CXBORDER = 5
Private Const SM_CYBORDER = 6
Private Const SM_CYCAPTION = 4
Private Const SM_CYMENU = 15
Public Enum eOrientationConstants
espVertical = 1
espHorizontal = 2
End Enum
Private m_hWnd As Long
Private m_eOrientation As eOrientationConstants
Private m_lBorder(1 To 4) As Long
Private m_oSplit As Object
Public Enum ESplitBorderTypes
espbLeft = 1
espbTop = 2
espbRight = 3
espbBottom = 4
End Enum
Private m_bIsMDI As Boolean
Private m_bSplitting As Boolean
Public Property Get SplitObject() As Object
Set SplitObject = m_oSplit
End Property
Public Property Let SplitObject(ByRef oThis As Object)
Set m_oSplit = oThis
On Error Resume Next
oThis.BorderStyle = 0
If (m_eOrientation = espHorizontal) Then
oThis.MousePointer = vbSizeNS
Else
oThis.MousePointer = vbSizeWE
End If
End Property
Public Property Let Border(ByVal eBorderType As ESplitBorderTypes, ByVal lSize As Long)
m_lBorder(eBorderType) = lSize
End Property
Public Property Get Border(ByVal eBorderType As ESplitBorderTypes) As Long
Border = m_lBorder(eBorderType)
End Property
Public Property Get Orientation() As eOrientationConstants
Orientation = m_eOrientation
End Property
Public Property Let Orientation(ByVal eOrientation As eOrientationConstants)
m_eOrientation = eOrientation
If Not (m_oSplit Is Nothing) Then
If (m_eOrientation = espHorizontal) Then
m_oSplit.MousePointer = vbSizeNS
m_lBorder(espbTop) = 64
m_lBorder(espbBottom) = 64
m_lBorder(espbLeft) = 0
m_lBorder(espbRight) = 0
Else
m_oSplit.MousePointer = vbSizeWE
m_lBorder(espbTop) = 0
m_lBorder(espbBottom) = 0
m_lBorder(espbLeft) = 64
m_lBorder(espbRight) = 64
End If
End If
End Property
Public Sub SplitterMouseDown( _
ByVal hwnd As Long, _
ByVal X As Long, _
ByVal Y As Long _
)
Dim tP As POINTAPI
m_hWnd = hwnd
' Send subsequent mouse messages to the owner window
SetCapture m_hWnd
' Get the window rectangle on the desktop of the owner window:
GetWindowRect m_hWnd, rcWindow
' Clip the cursor so it can't move outside the window:
ClipCursorRect rcWindow
' Check if this is an MDI form:
If (ClassName(m_hWnd) = "ThunderMDIForm") Then
' Get the inside portion of the MDI form:
' I'm assuming you have a caption,menu and border in your MDI here