Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),賀州企業(yè)網(wǎng)站建設(shè),賀州品牌網(wǎng)站建設(shè),網(wǎng)站定制,賀州網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,賀州網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿(mǎn)足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶(hù)成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
Dim postion1 As New Point
mouse_event(H1 Or H8000, postion1.X * 65535 / 1366, postion1.Y * 65535 / 768, 0, 0)
'按絕對(duì)位置移動(dòng)鼠標(biāo)
'在鼠標(biāo)坐標(biāo)系統(tǒng)中,屏幕在水平和垂直方向上均勻分割成65535×65535個(gè)單元,
'當(dāng)前所用顯示屏分辨率為1366*768
'所以要進(jìn)行如上轉(zhuǎn)換
mouse_event(H2, 0, 0, 0, 0) '鼠標(biāo)左鍵按下
mouse_event(H4, 0, 0, 0, 0) '鼠標(biāo)左鍵彈起
msdn上有 mouse_event 的詳解,大致使用如上
您好,建議您使用mouse_event或者?Cursor.Position來(lái)實(shí)現(xiàn)。例如:
1. 您需要將鼠標(biāo)移動(dòng)dx, dy的位置。
Public?Sub?MouseMoveBy(ByVal?dx?As?Integer,?ByVal?dy?As?Integer)
Cursor.Position?=?New?Point(Cursor.Position.X?+?dx,?Cursor.Position.Y?+?dy)
End?Sub
或者
Public?Sub?MouseMoveBy(ByVal?dx?As?Integer,?ByVal?dy?As?Integer)
mouse_event(0,?dx,?dy,?0,?0)
End?Sub
2. 您需要將鼠標(biāo)移動(dòng)到x, y的位置
Public?Sub?MouseMoveTo(ByVal?x?As?Integer,?ByVal?y?As?Integer)
Cursor.Position?=?New?Point(x,?y)
End?Sub
請(qǐng)您試一下。
控件是可以顯示在里面的,你只要加個(gè)label,把label的屬性設(shè)為visualble=fause就行。設(shè)置鼠標(biāo)經(jīng)過(guò)頭像的mouseHover和mouseLeave事件,當(dāng)mouseHover時(shí)label的屬性visualble=true,當(dāng)mouseLeave時(shí)label的屬性visualble=fause即可。窗體的鼠標(biāo)事件可以設(shè)置控件的cursor屬性,里面可以選擇許多種鼠標(biāo)圖形。 只要是正常的Form都可以改變窗體大小,但是無(wú)邊框的窗體只能用函數(shù)改變或者設(shè)置屬性,在debug后是不能改變的。拖動(dòng)窗體需要在窗體的load時(shí)間里面寫(xiě)入當(dāng)鼠標(biāo)單擊不放時(shí)的事件即可,不難。
調(diào)用api
在Visual Baisc.net中的聲明:
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模擬鼠標(biāo)左鍵按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模擬鼠標(biāo)左鍵釋放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模擬鼠標(biāo)中間鍵按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模擬鼠標(biāo)中間鍵釋放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模擬鼠標(biāo)右鍵按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模擬鼠標(biāo)右鍵釋放
Public Const MOUSEEVENTF_MOVE = H1 '模擬鼠標(biāo)指針移動(dòng)
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模擬鼠標(biāo)左鍵按下