å
ç¨mousedownäºä»¶è®°å½å¼å§é¼ æ çä½ç½®ï¼åç¨MouseMove äºä»¶ï¼é¼ æ 移å¨æ¶æ ¹æ®é¼ æ 移å¨ç大å°æ¹åæ§ä»¶ç大å°
MouseMove äºä»¶
æ¤äºä»¶å¨ç§»å¨é¼ æ æ¶åçã
è¯æ³
Private Sub Form_MouseMove(button As Integer, shift As Integer, x As Single, y As Single)
Private Sub MDIForm_MouseMove(button As Integer, shift As Integer, x As Single, y As Single)
Private Sub object_MouseMove([index As Integer,] button As Integer, shift As Integer, x As Single, y As Single)
MouseMove äºä»¶è¯æ³å
å«ä¸åé¨åï¼
é¨å æè¿°
object ä¸ä¸ªå¯¹è±¡è¡¨è¾¾å¼ï¼å
¶å¼æ¯âåºç¨äºâå表ä¸çä¸ä¸ªå¯¹è±¡ã
index ä¸ä¸ªæ´æ°ï¼ç¨æ¥å¯ä¸å°æ è¯ä¸ä¸ªå¨æ§ä»¶æ°ç»ä¸çæ§ä»¶ã
button ä¸ä¸ªæ´æ°ï¼å®å¯¹åºé¼ æ å个æé®çç¶æï¼å¦ææ个æé®æä¸ï¼å
¶ä¸å°±æä¸ä¸ªäºè¿å¶ä½è¢«è®¾ç½®ãbutton åæ°æ¯å
·æç¸åºäºå·¦æé®ï¼ä½ 0ï¼ï¼å³æé®ï¼ä½ 1ï¼ï¼ä»¥åä¸é´æé®ï¼ä½ 2ï¼çä¸ä¸ªä½å段ãè¿äºä½çå¼åå«çäº 1ï¼2ï¼å 4ãå®æ示è¿äºé¼ æ æé®çæ´ä½ç¶æï¼ä¸ä¸ªäºè¿å¶ä½ä¸çä¸äºãå
¨é¨ãæä¸ä¸ªä¹æ²¡æ被设置ï¼æ示è¿äºæé®ä¸çä¸äºãå
¨é¨ãæä¸ä¸ªä¹æ²¡æ被æä¸ã
shift ä¸ä¸ªæ´æ°ï¼è¯¥æ´æ°ç¸åºäº SHIFT,CTRL,å ALT é®çç¶æãæé®è¢«æä¸ä½¿å¾ä¸ä¸ªäºè¿å¶ä½è¢«è®¾ç½®ãshift åæ°æ¯å
·æç¸åºäº SHIFT é®ï¼ä½ 0ï¼ï¼CTRL é®ï¼ä½ 1ï¼ï¼ä»¥å ALT é®ï¼ä½ 2ï¼æå°äºè¿å¶ä½çä¸ä¸ªä½å段ãè¿äºä½çå¼åå«çäº 1ï¼2ï¼å 4ãshift åæ°æ示è¿äºé®çç¶æãè¿äºä½ä¸å¯è½æä¸äºãå
¨é¨ãæè
ä¸ä¸ªä¹æ²¡æ被设置ï¼æ示è¿äºé®ä¸çä¸äºãå
¨é¨ãæè
ä¸ä¸ªä¹æ²¡æ被æä¸ãä¾å¦ï¼CTRL å ALT é®é½è¢«æä¸ï¼å shift çå¼å°±æ¯ 6ã
x, y ä¸ä¸ªæå®é¼ æ æéå½åä½ç½®çæ°ãx å y çå¼æ表示çæ»æ¯éè¿è¯¥å¯¹è±¡ ScaleHeight, ScaleWidth, ScaleLeft,å ScaleTop å±æ§æ建ç«çåæ ç³»ç»çæ¹å¼ã
说æ
MouseMove äºä»¶ä¼´éé¼ æ æéå¨å¯¹è±¡é´ç§»å¨æ¶è¿ç»ä¸æå°äº§çãé¤éæå¦ä¸ä¸ªå¯¹è±¡æè·äºé¼ æ ï¼å¦åï¼å½é¼ æ ä½ç½®å¨å¯¹è±¡çè¾¹çèå´å
æ¶è¯¥å¯¹è±¡å°±è½æ¥æ¶ MouseMove äºä»¶ã
è¦æµè¯ button æ shift åæ°ï¼å¯ä½¿ç¨å¯¹è±¡æµè§å¨ä¸ç Visual Basic (VB) 对象åºä¸æååºç常æ°ï¼ç¨æ¥å®ä¹è¯¥åæ°ä¸çå个ä½ï¼
常æ°ï¼æé®ï¼ å¼ æè¿°
vbLeftButton 1 å·¦æé®æä¸ã
vbRightButton 2 å³æé®æä¸ã
vbMiddleButton 4 ä¸é´æé®æä¸ã
常æ°ï¼æ¢æ¡ï¼ å¼ æè¿°
vbShiftMask 1 SHIFT é®æä¸ã
vbCtrlMask 2 CTRL é®æä¸ã
vbAltMask 4 ALT é®æä¸ã
ç¶åè¿äºå¸¸æ°ç¨ä½ä½å±è½ï¼å¯¹äºæé®çåç§ç»åï¼æ 须计ç®åºå个ç»åçå¯ä¸çä½å段å¼å³å¯è¿è¡æ£æµã
è¦æµè¯æä¸æ¡ä»¶ï¼é¦å
å°å个ç»æèµç»ä¸ä¸ªä¸´æ¶æ´ååéç¶ååä¸ä¸ä¸ªä½å±è½ç button æ shift åæ°è¿è¡æ¯è¾ãæµè¯åºå½ç¨å个åæ°è¿è¡ And è¿ç®ï¼è¥ç»æ大äºé¶ï¼å说æ该é®ææé®è¢«æä¸ãå
¶æä½å¦ä¸ï¼
LeftDown = (Button And vbLeftButton) > 0
CtrlDown = (Shift And vbCtrlMask) > 0
ç¶åï¼æ¥ä¸å»å¯å¯¹ç»æçåç§ç»åè¿è¡æ£æµï¼å
¶æä½å¦ä¸ï¼
If LeftDown And CtrlDown Then
注æ 为äºå¯¹é¼ æ æé®æä¸åéæ¾æå¼èµ·çäºä»¶è¿è¡å¤çï¼å¯ä½¿ç¨ MouseDown å MouseUp äºä»¶è¿ç¨ã
MouseMove äºä»¶ç button åæ°ä¸ MouseDown å MouseUp äºä»¶ç button åæ°æ¯ä¸åçãå¯¹äº MouseMove äºä»¶æ¥è¯´ï¼button åæ°æ示çæ¯æææé®å½åçç¶æï¼ä¸ä¸ª MouseMove äºä»¶å¯æ示æäºãå
¨é¨æ没æä¸ä¸ªæé®è¢«æä¸ãå¯¹äº MouseDown å MouseUp äºä»¶æ¥è¯´ï¼button åæ°å¨æ¯ä¸ªäºä»¶ç²¾ç¡®å°æ示ä¸ä¸ªæé®ã
å¨ MouseMove äºä»¶ä¸ä»»ä½æ¶ä¾¯ç§»å¨çªå£ï¼é½è½å¼èµ·å±å äºä»¶ãå½è¯¥çªå£ç§»å¨å°æéä¸é¢æ¶ MouseMove äºä»¶å°äº§çãå³ä½¿æ¯é¼ æ å®å
¨ä¸å¨ MouseMove äºä»¶ä¹è½äº§çã
温馨提示:答案为网友推荐,仅供参考