Skip to content

Planet-Source-Code/kenny-lai-lai-ho-wa-move-a-no-border-form-by-any-thing__1-24444

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Move a No-Border form by any thing!

Description

To have a better UI, programmers usually use a borderless form. But there's no caption bar and the form cannot be move. This code help you to move a form by clicking anything that support mousemove, mouseup, mousedown events. See it , it's cool!

More Info

Submitted On
By Kenny Lai, Lai Ho Wa
Level Beginner
User Rating 5.0 (10 globes from 2 users)
Compatibility VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Category VB function enhancement
World Visual Basic
Archive File

Source Code

<<>>
Dim ism as boolean


Public Type POINTAPI
x As Long
y As Long
End Type


Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long


Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long




Private Sub lbltitle_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
ism = True
x1 = x + lblTitle.Left
y1 = y + lblTitle.Top
End Sub



Private Sub lbltitle_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If ism = True Then
i = GetCursorPos(Pos)
x2 = Pos.x * Screen.TwipsPerPixelX
y2 = Pos.y * Screen.TwipsPerPixelY
Me.Move (x2 - x1), (y2 - y1)
End If
End Sub



Private Sub lbltitle_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Me.Top < 0 Then Me.Top = 0
If Me.Left < 0 Then Me.Left = 0
If Me.Top > (Screen.Height - (Me.Height / 10)) Then Me.Top = Screen.Height * 9 / 10
If Me.Left > (Screen.Width - (Me.Width / 10)) Then Me.Left = Screen.Width * 9 / 10
ism = False
End Sub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published