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
Ïà¹ØÎĵµ£º
http://social.msdn.microsoft.com/Forums/zh-TW/232/thread/5b0e0eb7-9cd7-420a-9f56-e588154174ba
http://www.mndsoft.com/blog/article.asp?id=903
http://topic.csdn.net/t/20051015/14/4328396.html
¡¡¡¡VBÊdz£ÓõÄÓ¦ÓÃÈí¼þ¿ª·¢¹¤¾ßÖ®Ò»£¬ÓÉÓÚVBµÄ±¨±í¹¦ÄÜÓÐÏÞ£¬¶øÇÒÒ»µ«±¨±í¸ñʽ·¢Éú±ä»¯£¬¾ÍµÃÏàÓ¦Ð޸ijÌÐò£ ......
VERSION 5.00
Begin VB.Form Form2
AutoRedraw = -1 'True
Caption = "¼ÆËã½çÃæ"
ClientHeight = 4905
ClientLe ......
Option Explicit
Dim potflag As Integer '±êʶÊÇ·ñÓÃСÊýµã
Dim numcol As Integer ' µã»÷ÔËËã·ûµÄ¸öÊý
Dim LastInput ' ָʾÉÏÒ»´Î²Ù×÷µÄÄÚÈÝ
Dim colflag ......
È«ÆÁ
Private Sub Form_Load()
Me.Width = Screen.Width
Me.Height = Screen.Height
Me.WindowState = 2
End Sub
Öö¥
1.ÔÚVBµÄͨÓôúÂëÀïдÈëAPIÉùÃ÷
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, _
&n ......