Advertisement
5_2007-2008 Files/ File Controls/ Input/ Output #188084

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

Yapay Zeka Özeti: 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.

Kaynak Kod
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
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı