Advertisement
ASP_Volume2 Files/ File Controls/ Input/ Output #44082

Moving Borderless Forms Without Windows API

This an easy way to move a windows form without a border. It does now use the windows API very easy to understand code is very short. Simply click down on the form and move the mouse. the form will move with the mouse alot easier to use instead of the windows API

AI

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
Dim newPoint As New System.Drawing.Point()
 Dim a As Integer
 Dim b As Integer
 Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
  a = Me.MousePosition.X - Me.Location.X
  b = Me.MousePosition.Y - Me.Location.Y
 End Sub
 Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
  If e.Button = MouseButtons.Left Then
   newPoint = Me.MousePosition
   newPoint.X = newPoint.X - (a)
   newPoint.Y = newPoint.Y - (b)
   Me.Location = newPoint
  End If
 End Sub
원본 댓글 (3)
Wayback Machine에서 복구됨