タイトルバーを消去したフォームは移動できなくなりますが、そのようなフォームを移動させるサンプルです。
'-------------------------------------------------------
'
'-------------------------------------------------------
DimmlngOLdPosAsPOINTAPI
Private SubForm_MouseDown(ButtonAs Integer, ShiftAs Integer, xAs Single, yAs Single)
mlngOLdPos.x = x / Screen.TwipsPerPixelX
mlngOLdPos.y = y / Screen.TwipsPerPixelY
'スクリーン座標に変換
CallClientToScreen(Me.hwnd, mlngOLdPos)
End Sub
Private SubForm_MouseMove(ButtonAs Integer, ShiftAs Integer, xAs Single, yAs Single)
DimlngNewPosAsPOINTAPI
IfButton = vbLeftButtonThen
Else
Exit Sub
End If
lngNewPos.x = x / Screen.TwipsPerPixelX
lngNewPos.y = y / Screen.TwipsPerPixelY
CallClientToScreen(Me.hwnd, lngNewPos)
Me.Top = Me.Top + ((lngNewPos.y - mlngOLdPos.y) * Screen.TwipsPerPixelY)
Me.Left = Me.Left + ((lngNewPos.x - mlngOLdPos.x) * Screen.TwipsPerPixelX)
mlngOLdPos = lngNewPos
End Sub
'-------------------------------------------------------
' Module
'-------------------------------------------------------
Declare FunctionClientToScreenLib"user32" (ByValhwndAs Long, lpPointAsPOINTAPI)As Long
TypePOINTAPI
xAs Long
yAs Long
End Type
DownLoad vbtips101.lzh 2KB (VB6.0)