{"id":145,"date":"2012-07-31T15:29:00","date_gmt":"2012-07-31T07:29:00","guid":{"rendered":"http:\/\/31.0.2.219:81\/?p=145"},"modified":"2014-03-11T13:23:37","modified_gmt":"2014-03-11T05:23:37","slug":"vb%e7%a7%bb%e5%8a%a8%e6%b2%a1%e6%9c%89%e6%a0%87%e9%a2%98%e6%a0%8f%e7%9a%84%e7%aa%97%e5%8f%a3","status":"publish","type":"post","link":"http:\/\/www.huike007.cn\/?p=145","title":{"rendered":"vb\u79fb\u52a8\u6ca1\u6709\u6807\u9898\u680f\u7684\u7a97\u53e3"},"content":{"rendered":"<p>\u65b9\u6cd51\uff1aAPI\uff08\u6a21\u62df\u9f20\u6807\u64cd\u4f5c\uff09<br \/>\n\u9996\u5148\u52a0\u5165\u4ee5\u4e0b API \u58f0\u660e\u4ee5\u53ca\u76f8\u5173\u5e38\u6570\uff08\u5728\u6807\u51c6\u6a21\u5757\u4e2d\u7528 Public\uff1b\u5728\u7c7b\u6a21\u5757\u6216\u7a97\u4f53\u4e2d\u7528 Private\uff09\uff1a<br \/>\nPublic\/Private Declare Function SendMessage Lib &#34;user32&#34; Alias &#34;SendMessageA&#34; (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long<br \/>\nPublic\/Private Declare Function ReleaseCapture Lib &#34;user32&#34; () As Long<br \/>\nPublic\/Private Const WM_NCLBUTTONDOWN = &amp;HA1   &#39;\u8868\u793a\u5728\u975e\u5ba2\u6237\u533a\uff08\u6807\u9898\u680f\u3001\u8fb9\u6846\uff09\u6309\u4e0b\u9f20\u6807\u5de6\u952e<br \/>\nPublic\/Private Const HTCAPTION = 2     &#39;\u8868\u793a\u9f20\u6807\u51fb\u4e2d\u4e86\u7a97\u53e3\u7684\u6807\u9898\u680f<br \/>\n\u7136\u540e\u5728\u67d0\u4e2a\u63a7\u4ef6\u7684 MouseDown \u4e8b\u4ef6\u7684\u5904\u7406\u7a0b\u5e8f\u4e2d\u52a0\u5165\uff1a<br \/>\nReleaseCapture<br \/>\n&#39;\u5728 VB \u5185\u90e8\u90fd\u4f1a\u81ea\u52a8\u4f7f\u7528 SetCapture\uff08API\uff09\u6765\u6355\u6349\u9f20\u6807\u4e8b\u4ef6<br \/>\n&#39;\u56e0\u6b64\u5148\u4f7f\u7528 ReleaseCapture \u4f7f SetCapture \u5931\u6548<br \/>\nSendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&amp;<br \/>\n&#39;\u7136\u540e\u5411\u7a97\u53e3\u53d1\u9001\u9f20\u6807\u5728\u6807\u9898\u680f\u88ab\u6309\u4e0b\u7684\u6d88\u606f<br \/>\n\u4f8b\u5982\uff1a<br \/>\nPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)<br \/>\nReleaseCapture<br \/>\nSendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&amp;<br \/>\nEnd Sub<br \/>\n\u65b9\u6cd52\uff1aVB<br \/>\n\u4ee5\u901a\u8fc7\u7a97\u53e3\u4e0a\u7684\u4e00\u4e2a\u6309\u94ae\uff08Command1\uff09\u6765\u62d6\u52a8\u7a97\u53e3\u4e3a\u4f8b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<br \/>\nDim LastX As Single, LastY As Single, IsMoving As Boolean<br \/>\nPrivate Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)<br \/>\nIf Button = vbLeftButton Then<br \/>\n    LastX = X<br \/>\n    LastY = Y<br \/>\n    IsMoving = True<br \/>\nEnd If<br \/>\nEnd Sub<br \/>\nPrivate Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)<br \/>\nIf IsMoving Then<br \/>\n    Me.Move Me.Left + (X &#8211; LastX), Me.Top + (Y &#8211; LastY)<br \/>\nEnd If<br \/>\nEnd Sub<br \/>\nPrivate Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)<br \/>\nIsMoving = False<br \/>\nEnd Sub<br \/>\n\u65b9\u6cd51\u8f83\u4e3a\u7b80\u4fbf\uff0c\u4f46\u786e\u5b9e\u6709\u6548\uff1b<br \/>\n\u65b9\u6cd52\u7684\u64cd\u63a7\u6027\u8f83\u5f3a\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u7a0b\u5e8f\u6765\u5e72\u9884\u62d6\u52a8\u8fc7\u7a0b\uff08\u4f8b\u5982\u9632\u6b62\u7a97\u53e3\u88ab\u62d6\u79bb\u5c4f\u5e55\uff09\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b9\u6cd51\uff1aAPI\uff08\u6a21\u62df\u9f20\u6807\u64cd\u4f5c\uff09 \u9996\u5148\u52a0\u5165\u4ee5\u4e0b API \u58f0\u660e\u4ee5\u53ca\u76f8\u5173\u5e38\u6570\uff08\u5728\u6807\u51c6\u6a21\u5757\u4e2d\u7528 Public\uff1b\u5728\u7c7b\u6a21\u5757 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[181],"tags":[227],"_links":{"self":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/145"}],"collection":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=145"}],"version-history":[{"count":1,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/145\/revisions"}],"predecessor-version":[{"id":230,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=\/wp\/v2\/posts\/145\/revisions\/230"}],"wp:attachment":[{"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=145"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.huike007.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}