VB实现全窗体移动
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End If
End Sub
http://topic.csdn.net/t/20030524/18/1829023.html
http://zhidao.baidu.com/question/93411647.html?fr=qrl&cid=867&index=5&fr2=query
我想把form5移动到form3中picture1的位置,下面是我的代码(在form3的code中):
Dim r2 As RECT
GetWindowRect Picture1.hwnd, r2
Form5.ScaleMode = vbPixels '设置坐标单位为像素
Form5.Move r2.Left, r2.Top
Form5.Show
为什么移动的坐标仍然是默认的缇而不是屏幕像素呢?
请指教!
问题补充:
要实现窗口的正确移动,应该怎么做?
将form5的左上角的位置挪到form3中picture1左上角的位置
'form3中
Private Type rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As rect) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Sub Command1_Click()
Dim wrect As rect
Dim picrect As rect
GetWindowRect Picture1.hwnd, picrect
GetWindowRect Form5.hwnd, wrect
MoveWindow Form5.hwnd, picrect.Left, picrect.Top, wrect.Right - wrect.Left, wrect.Bottom - wrect.Top, True
Form5.Show
End Sub
相关文档:
Option Explicit
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const scuseragent = "vb wininet"
Private Const INTERNET_FLAG_PASSIVE = &H8000000
'调用设置环境
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long ......
现在宽屏,大屏幕显示器越来越普遍,原来在800*600下设计的软件界面,在大屏幕显示器(1680*1050)上界面总是缩到一角,非常难看,要将老程序的界面按照不同的分辨率在重新进行设计编程,整个过程比较复杂而且实用性不大,如果原来程序比较大且界面比较多的话那么工作量也将是巨大的,而且还可能出现其他错误,有没有一种重 ......
Private Sub Form_load()
'判断程序是否已经运行
If App.PrevInstance
Then
MsgBox "本程序已经运行!", vbInformation Or vbOKOnly, "提示信息"
Unload
Me
Exit Sub
&n ......
webbrowser 不能收到SendMessage的消息
主要是因为1webbrowser 的句柄找不到。经过努力搜索,终于解决了。做个记录.
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function ......
Dim p(10000, 1) As Double
Dim num As Integer
Dim ptx As Single
Dim pty As Single
Dim w0, w1, w2, w3 As Single
Private Sub Command1_Click()
Dim t As Single
Dim i As Integer
Dim f0, f1, f2, f3 As Single
Picture1.DrawWidth = 3
For t = 0 To 1 St ......