OnMouseMove

OnMouseMove,計算機函式,當滑鼠移動時調用此函式。

函式原型:
 afx_msg void OnMouseMove(
UINT nFlags,
CPoint point
);
當滑鼠移動時調用此函式 。
參數:
nFlags
指示各種虛擬按鍵是否按下 ,此參數可以是任何下列值的組合:
MK_CONTROL 當CTRL鍵按下時。
MK_LBUTTON 當滑鼠左鍵按下時。
MK_MBUTTON 當滑鼠中鍵按下時。
MK_RBUTTON 當滑鼠右鍵按下時.
MK_SHIFT 當SHIFT按下時。
point 滑鼠的X,Y坐標:該坐標為 滑鼠距離截獲該訊息的視窗左上角的位置 是一個相對位置而不是在螢幕像素上的絕對位置。
例如:當視窗的左上角坐標為(10,10)那么當滑鼠在螢幕的(10,10)像素點的時候,OnMouseMove函式point值為(0,0)因為是相對視窗左上角的相對位置。支持該事件的 HTML 標籤:

<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>,
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>,
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>,
<li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>,
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>,
<tr>, <tt>, <ul>, <var>

支持該事件的 JavaScript 對象:

onmousemove is, by default, not an event of any object, because mouse movement happens very frequently.

提示和注釋

注釋:每當用戶把滑鼠移動一個像素,就會發生一個 mousemove 事件。這會耗費系統資源去處理所有這些 mousemove 事件。因此請審慎地使用該事件。(現在的電腦都能承受的住小小的mousemove 事件)

實例

下面的例子中,當用戶把滑鼠移動到圖像上時,將顯示一個對話框:
<img src="/i/eg_mouse2.jpg" alt="mouse" onmousemove="alert('您的滑鼠剛才經過了圖片!')" />

相關詞條

相關搜尋

熱門詞條

聯絡我們