拖动窗口 - 无需 API
本文档描述了如何在不调用任何 API 的情况下移动没有框架的窗口。

引言
在本文中,您将学习如何在不使用 Windows API 或其他函数的情况下拖动没有标题栏的窗口。
这篇文章对那些厌倦了在屏幕上移动无框架窗口的程序员们来说很有用。好了,这里有一些可能让你摆脱困扰的东西……一些新的尝试!!!我之前写过这段代码,希望你们中的一些人能找到用处。
背景
在制作我的应用程序之一时,我需要一些可以移动窗口的函数。但是 Visual Studio 没有提供这样的工具。所以我自己编写了所有函数,因为我不想使用任何 API。
Using the Code
鼠标事件
MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
变量
CurrX, CurrY
作为Single
函数
Private Function DragWindow(Button As Integer, X As Single, Y As Single)
If Button = 1 Then
Me.Left = Me.Left + (X - CurrX)
Me.Top = Me.Top + (Y - CurrY)
End If
End Function
历史
- 2005-08-12 - 文章的初始发布