PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: MouseUp... MouseDown... & MouseMove with NTB!  (Read 203 times)

veltesian

  • Little Newbie
  • *
  • Posts: 47
MouseUp... MouseDown... & MouseMove with NTB!
« on: August 08, 2020, 10:13:17 PM »

hello everyone ...

i was experimenting recently in the past few days & figured out
that the form's title bar doesn't have to exist.... for it to move.
please feel free to check the attachment... let me know what
you think of it.


« Last Edit: August 08, 2020, 10:17:08 PM by veltesian »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9313
  • Windows 10
    • PlanetSquires Software
Re: MouseUp... MouseDown... & MouseMove with NTB!
« Reply #1 on: August 09, 2020, 09:48:59 AM »

Hi,

Here is a lot easier way of doing it. It is an old technique that simulates dragging the form via a title bar even though the title bar does not exist. Also, I changed your "End" statement to "Form1.close" as that is a better way to close the main form and end the application.

Code: [Select]
' You should always include a resource file that references a valid manifest.xml
' file otherwise your application will not properly display Windows themed controls.
' Sample resource.rc and manifest.xml files can be found in the WinFBE \Settings folder.
' The following WinFBE directive includes the resource in your application. Simply
' uncomment the line.
' If you are using WinFBE's project management features then delete the following line
' because a resource file will be generated automatically.
'     '#RESOURCE "resource.rc"


''
''  Remove the following Application.Run code if it used elsewhere in your application.
Application.Run(Form1)

''
''
Function Form1_btn_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
    'end
    Form1.Close
    Function = 0
End Function

''
''
Function Form1_MouseDown( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT

   ' Simulate click down on caption
   if e.LButton then
      SendMessage( sender.hWindow, WM_NCLBUTTONDOWN, HTCAPTION, 0 )
   end if

   Function = 0
End Function

Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

veltesian

  • Little Newbie
  • *
  • Posts: 47
Re: MouseUp... MouseDown... & MouseMove with NTB!
« Reply #2 on: August 11, 2020, 09:03:09 PM »

thanks for correcting that for me paul.... i was unsure about how to close out a function... (cancel out of an event
if a control needs an exit command) as far as the mouseDWN / mouseUP & mouse move events are concerened,...
i realized it was kinda cheesy using what i did but thanks again for helping me understand that right code to use....
Logged