Advertisement
ASP_Volume3 Files/ File Controls/ Input/ Output #60269

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

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