hi again,
i have project which i set form border style to none, but i can't to dragging form anymore.
please help me how to do this with code sample cause i don't have any idea...
ok. help me all...
best regards from u..
hi again,
i have project which i set form border style to none, but i can't to dragging form anymore.
please help me how to do this with code sample cause i don't have any idea...
ok. help me all...
best regards from u..
u can use api function to solve this problem.
i guest SendMessage function. this function will tell system that u clicked the titlebar.
hi jade_me..
sawamura already give the function u just add one function again to release capture.
try this following code :
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 Sub ReleaseCapture Lib "user32" ()
Const WM_NCLBUTTONDOWN = &HA1 'when left mouse button is clicked
Const HTCAPTION = 2 'signed that mouse is working on titlebar.
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Call ReleaseCapture 'tell system through mouse didn't working anymore.
'tell system through mouse already working on form.
Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Call ReleaseCapture
Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub
Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then 'if left mouse button working.
If Picture2.BorderStyle = 1 Then
Picture2.BorderStyle = 0
Else
Picture2.BorderStyle = 1
End If
End If
End Sub
oh yeah, picture1 is titlebar and picture2 is like exit sign.
ok. this all from me, you can change code as u needed.
all for the best
thx sawamura.
thx jx_man.
my project running cleared.
That piece of code is really useful.
thk for useful source.
This way is also good for draging form.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.