Report.MouseDown 事件 (Access)Report.MouseDown event (Access)

MouseDown 事件會在使用者按下滑鼠按鈕時發生。The MouseDown event occurs when the user presses a mouse button.

語法Syntax

運算式MouseDown(] 按鈕shift 鍵XY)expression.MouseDown (Button, Shift, X, Y)

_運算式_代表**Report** 物件的變數。expression A variable that represents a Report object.

參數Parameters

名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
ButtonButton 必要Required IntegerInteger 用來引動事件的按鈕。The button that was pressed to trigger the event. 如果您需要測試_Button_引數,您可以使用下列其中一個內部常數作為位元遮罩:If you need to test for the Button argument, you can use one of the following intrinsic constants as bit masks:
  • acLeftButton 滑鼠左鍵的位元遮罩。acLeftButton The bit mask for the left mouse button.

  • acrightbutton 右鍵是 右滑鼠按鈕位元遮罩。acRightButton The bit mask for the right mouse button.

  • acMiddleButton 中間滑鼠按鈕位元遮罩。acMiddleButton The bit mask for the middle mouse button.

ShiftShift 必要Required IntegerInteger _按鈕_引數所指定的按鈕已按下或發行時會 Shift、 Ctrl 和 Alt 鍵的狀態。The state of the Shift, Ctrl, and Alt keys when the button specified by the Button argument was pressed or released. 如果您需要測試_Shift_引數,您可以使用下列其中一個內部常數作為位元遮罩:If you need to test for the Shift argument, you can use one of the following intrinsic constants as bit masks:
  • acShiftMask Shift 鍵的位元遮罩。acShiftMask The bit mask for the Shift key.

  • acCtrlMask Ctrl 鍵的位元遮罩。acCtrlMask The bit mask for the Ctrl key.

  • acAltMask Alt 鍵的位元遮罩。acAltMask The bit mask for the Alt key.

XX 必要Required SingleSingle 目前滑鼠指標,以twip 為單位的位置的_x_座標。The x coordinate for the current location of the mouse pointer, in twips.
YY 必要Required SingleSingle 目前滑鼠指標,以 twip 為單位的位置的_y_座標。The y coordinate for the current location of the mouse pointer, in twips.

註解Remarks

MouseDown事件可套只能用於表單、 表單區段及表單上的控制項和不適用於報表上的控制項。The MouseDown event applies only to forms, form sections, and controls on a form, and not to controls on a report.

此事件不適用於附加到另一個控制項的標籤,例如文字方塊的標籤。This event does not apply to a label attached to another control, such as the label for a text box. 它只適用於「獨立式」標籤。It applies only to "freestanding" labels. 在附加標籤上按下及放開滑鼠按鈕的效果,與在關聯控制項上按下及放開滑鼠按鈕的效果相同。Pressing and releasing a mouse button in an attached label has the same effect as pressing and releasing the button in the associated control. 此時所發生的事件為控制項的一般事件,而非附加標籤的個別事件。The normal events for the control occur; no separate events occur for the attached label.

發生這些事件時執行巨集或事件程序,將 OnMouseDown 屬性設定為巨集名稱或 [事件程序]。To run a macro or event procedure when these events occur, set the OnMouseDown property to the name of the macro or to [Event Procedure].

您可以使用 MouseDown 事件來指定特定的滑鼠按鈕已按下或發行時會發生什麼情況。You can use a MouseDown event to specify what happens when a particular mouse button is pressed or released. 按一下 [DblClick 事件,不同 MouseDown 事件可讓您區分左、 右及中間滑鼠按鈕。Unlike the Click and DblClick events, the MouseDown event enables you to distinguish between the left, right, and middle mouse buttons. 您也可以撰寫程式碼的滑鼠鍵盤組合使用 Shift、 Ctrl 和 Alt 鍵。You can also write code for mouse-keyboard combinations that use the Shift, Ctrl, and Alt keys.

若要針對報表引發 MouseDown 事件,請在此報表的空白區域中按下滑鼠按鈕。To cause a MouseDown event for a report to occur, press the mouse button in a blank area on the report. 若要針對報表區段引發 MouseDown 事件,請在此報表區段的空白區域中按下滑鼠按鈕。To cause a MouseDown event for a report section to occur, press the mouse button in a blank area of the report section.

下列情況適用於 MouseDown 事件:The following apply to MouseDown events:

  • 當滑鼠指標位於報表或控制項上方時按下滑鼠按鈕,該物件便會接收所有的滑鼠事件,且包含最後一個 MouseUp 事件。If a mouse button is pressed while the pointer is over a report or control, that object receives all mouse events up to and including the last MouseUp event.

  • 若是連續按下滑鼠按鈕,則在第一次按下之後收到滑鼠事件的物件會接收所有的滑鼠事件,直到所有的按鈕都放開為止。If mouse buttons are pressed in succession, the object that receives the mouse event after the first press receives all mouse events until all buttons are released.

若要回應移動滑鼠所引發的事件,您可以使用 MouseMove 事件。To respond to an event caused by moving the mouse, you use a MouseMove event.

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.