Advertisement
5_2007-2008 Miscellaneous #176315

Drag a form WITHOUT a title bar!

With this code you can easily drag a form without a titlebar.

AI

ملخص الذكاء الاصطناعي: 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.

كود المصدر
original-source
'code
Private Sub FormDrag(frm As Form)
  ReleaseCapture
  Call SendMessage(frm.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End Sub

'usage:
'put in MouseDown even of almost anything.
'a form a label, a command button, anything will work.
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = 1 Then Call FormDrag(Me)
End Sub
'If you dont add If Button = 1 etc.. 
'then if you left click, then right 
'click the form will continue to 
'move even though you arent clicking,
'its like the form is stuck to your mouse
التعليقات الأصلية (3)
مسترجع من Wayback Machine