如果你觉的資源文件不习惯的话可以用另外一种方法1、在image中放一个光标文件 *.ico 或 *.cur 2、写下面的代码 Private Sub Form_Load() Form1.MousePointer = 99 Image1.Visible = False End SubPrivate Sub Command1_Click() Form1.MouseIcon = Image1.Picture End Sub
我给了它一个"手指"的指针,可它的CLICK总是响应在手腕!如何让它响应在手指?谢谢
当鼠标离开控件时,如何让它恢复为原来的指针(vbDefault)?
当鼠标离开控件时,如何让它恢复为原来的指针(vbDefault)?
用VB6.0的光盤上的TOOL﹐叫ImageEdit
'在Picture上为Image1.Picture Private Sub Form_Load() Picture1.MousePointer = 99 Image1.Visible = False End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.MouseIcon = Image1.Picture End Sub
回到FORM中时,还要做一个form1_mousemove吧
Option Explicit Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseCapture Lib "user32" () As LongPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MouseEnter As Boolean MouseEnter = (0 <= X) And (X <= Picture1.Width) And (0 <= Y) And (Y <= Picture1.Height)
If MouseEnter Then ' SetCapture Picture1.hwnd Text1.Text = "Mouse in picuture!" Else Text1.Text = "Mouse out!" ReleaseCapture End If
Declare Function SetCursor Lib "user32" Alias "SetCursor" (ByVal hCursor As Long) As LongPrivate Declare Function CreateCursor Lib "user32" (ByVal hInstance As Long, ByVal nXhotspot As Long, ByVal nYhotspot As Long, ByVal nWidth As Long, ByVal nHeight As Long, lpANDbitPlane As Any, lpXORbitPlane As Any) As Long Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Form_Load() 'KPD-Team 1999 'URL: http://www.allapi.net/ 'E-Mail: [email protected]
' Create a 32x32 color cursor shaped somewhat like a yin-yang symbol. ' (The bit masks come from Microsoft's documentation on the API cursors function, just to ' give them their due credit.) Note how the masks are loaded into the arrays. The new ' cursor is then set to be the cursor for 10 seconds. Dim hnewcursor As Long ' newly created cursor Dim holdcursor As Long ' receives handle of default cursor Dim andbuffer As String, xorbuffer As String ' buffers for masks Dim andbits(0 To 127) As Byte ' stores the AND mask Dim xorbits(0 To 127) As Byte ' stores the XOR mask Dim c As Integer, retval As Long ' counter and return value ' Unfortunately, VB does not provide a nice way to load lots of information into an array. ' To load the AND and XOR masks, we put the raw hex values into the string buffers ' and use a loop to convert the hex values into numeric values and load them into ' the elements of the array. Yes, it's ugly, but there's no better way. Note the ' use of the line-continuation character here. Each sequence of eight hex ' characters represents one line in the 32x32 cursor. andbuffer = "FFFC3FFF" & "FFC01FFF" & "FF003FFF" & "FE00FFFF" & _ "F701FFFF" & "F003FFFF" & "F003FFFF" & "E007FFFF" & _ "C007FFFF" & "C00FFFFF" & "800FFFFF" & "800FFFFF" & _ "8007FFFF" & "8007FFFF" & "0003FFFF" & "0000FFFF" & _ "00007FFF" & "00001FFF" & "00000FFF" & "80000FFF" & _ "800007FF" & "800007FF" & "C00007FF" & "C0000FFF" & _ "E0000FFF" & "F0001FFF" & "F0001FFF" & "F8003FFF" & _ "FE007FFF" & "FF00FFFF" & "FFC3FFFF" & "FFFFFFFF" xorbuffer = "00000000" & "0003C000" & "003F0000" & "00FE0000" & _ "0EFC0000" & "07F80000" & "07F80000" & "0FF00000" & _ "1FF00000" & "1FE00000" & "3FE00000" & "3FE00000" & _ "3FF00000" & "7FF00000" & "7FF80000" & "7FFC0000" & _ "7FFF0000" & "7FFF8000" & "7FFFE000" & "3FFFE000" & _ "3FC7F000" & "3F83F000" & "1F83F000" & "1F83E000" & _ "0FC7E000" & "07FFC000" & "07FFC000" & "01FF8000" & _ "00FF0000" & "003C0000" & "00000000" & "00000000" ' Now load these hex values into the proper arrays. For c = 0 To 127 andbits(c) = Val("&H" & Mid(andbuffer, 2 * c + 1, 2)) xorbits(c) = Val("&H" & Mid(xorbuffer, 2 * c + 1, 2)) Next c ' Finally, create this cursor! The hotspot is at (19,2) on the cursor. hnewcursor = CreateCursor(App.hInstance, 19, 2, 32, 32, andbits(0), xorbits(0)) ' Set the new cursor as the current cursor for 10 seconds and then switch back. holdcursor = SetCursor(hnewcursor) ' change cursor Sleep 10000 'Wait 10 seconds retval = SetCursor(holdcursor) ' change cursor back ' Destroy the new cursor. retval = DestroyCursor(hnewcursor) End Sub例子如上,自己参悟把
实在对不起诸位老大,大家这样热心,只是昨日我的一位关系很好的同事病了我打车陪他去医院.所以....我相信大家一定会体谅我的呦!!!!!朋友更重要吗!!!今日回来,看到大家这样的热心我真的十分感动,CSDN的朋友们真的没让我失望!!!我相信在大家的团结下,中国的programers一定回迅速成长,壮大的......再次感谢大家过十分钟,我再给大家加分!希望大家能看到我的留言小弟分数有限不能给所有的朋友加分,希望没得到分的朋友不要生气!!!!!!下次还有机会 顺便说一下,楼上的API声明部分在F5时报错"Complied error:Ambiguous name detected:SetCursor"是咋回事? Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long ?????????????????????????????????????????????????????????????????????
Form1.MouseIcon = LoadPicture("d:\yl\test\handpnt.cur")
为什么不好使?
2、写下面的代码
Private Sub Form_Load()
Form1.MousePointer = 99
Image1.Visible = False
End SubPrivate Sub Command1_Click()
Form1.MouseIcon = Image1.Picture
End Sub
Private Sub Form_Load()
Picture1.MousePointer = 99
Image1.Visible = False
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.MouseIcon = Image1.Picture
End Sub
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As LongPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MouseEnter As Boolean
MouseEnter = (0 <= X) And (X <= Picture1.Width) And (0 <= Y) And (Y <= Picture1.Height)
If MouseEnter Then
'
SetCapture Picture1.hwnd
Text1.Text = "Mouse in picuture!"
Else
Text1.Text = "Mouse out!"
ReleaseCapture
End If
End Sub
给我发MAIL吧! 谢了!!!!!!!
可以自己做鼠标的指针Imagedit.exe相关文件:http://www.csdn.net/filebbs/read_topic.asp?id=263http://www.csdn.net/filebbs/read_topic.asp?id=263Imagedit.exe (89K)
可以自己做鼠标的指针Imagedit.exe相关文件: T_263_1.zip(41K)
http://www.csdn.net/filebbs/read_topic.asp?id=263http://www.csdn.net/filebbs/read_topic.asp?id=263Imagedit.exe (89K)
可以自己做鼠标的指针Imagedit.exe相关文件: T_263_1.zip(41K) T_263_1.zip(41K)
Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
' Create a 32x32 color cursor shaped somewhat like a yin-yang symbol.
' (The bit masks come from Microsoft's documentation on the API cursors function, just to
' give them their due credit.) Note how the masks are loaded into the arrays. The new
' cursor is then set to be the cursor for 10 seconds.
Dim hnewcursor As Long ' newly created cursor
Dim holdcursor As Long ' receives handle of default cursor
Dim andbuffer As String, xorbuffer As String ' buffers for masks
Dim andbits(0 To 127) As Byte ' stores the AND mask
Dim xorbits(0 To 127) As Byte ' stores the XOR mask
Dim c As Integer, retval As Long ' counter and return value ' Unfortunately, VB does not provide a nice way to load lots of information into an array.
' To load the AND and XOR masks, we put the raw hex values into the string buffers
' and use a loop to convert the hex values into numeric values and load them into
' the elements of the array. Yes, it's ugly, but there's no better way. Note the
' use of the line-continuation character here. Each sequence of eight hex
' characters represents one line in the 32x32 cursor.
andbuffer = "FFFC3FFF" & "FFC01FFF" & "FF003FFF" & "FE00FFFF" & _
"F701FFFF" & "F003FFFF" & "F003FFFF" & "E007FFFF" & _
"C007FFFF" & "C00FFFFF" & "800FFFFF" & "800FFFFF" & _
"8007FFFF" & "8007FFFF" & "0003FFFF" & "0000FFFF" & _
"00007FFF" & "00001FFF" & "00000FFF" & "80000FFF" & _
"800007FF" & "800007FF" & "C00007FF" & "C0000FFF" & _
"E0000FFF" & "F0001FFF" & "F0001FFF" & "F8003FFF" & _
"FE007FFF" & "FF00FFFF" & "FFC3FFFF" & "FFFFFFFF"
xorbuffer = "00000000" & "0003C000" & "003F0000" & "00FE0000" & _
"0EFC0000" & "07F80000" & "07F80000" & "0FF00000" & _
"1FF00000" & "1FE00000" & "3FE00000" & "3FE00000" & _
"3FF00000" & "7FF00000" & "7FF80000" & "7FFC0000" & _
"7FFF0000" & "7FFF8000" & "7FFFE000" & "3FFFE000" & _
"3FC7F000" & "3F83F000" & "1F83F000" & "1F83E000" & _
"0FC7E000" & "07FFC000" & "07FFC000" & "01FF8000" & _
"00FF0000" & "003C0000" & "00000000" & "00000000"
' Now load these hex values into the proper arrays.
For c = 0 To 127
andbits(c) = Val("&H" & Mid(andbuffer, 2 * c + 1, 2))
xorbits(c) = Val("&H" & Mid(xorbuffer, 2 * c + 1, 2))
Next c
' Finally, create this cursor! The hotspot is at (19,2) on the cursor.
hnewcursor = CreateCursor(App.hInstance, 19, 2, 32, 32, andbits(0), xorbits(0))
' Set the new cursor as the current cursor for 10 seconds and then switch back.
holdcursor = SetCursor(hnewcursor) ' change cursor
Sleep 10000 'Wait 10 seconds
retval = SetCursor(holdcursor) ' change cursor back
' Destroy the new cursor.
retval = DestroyCursor(hnewcursor)
End Sub例子如上,自己参悟把
顺便说一下,楼上的API声明部分在F5时报错"Complied error:Ambiguous name detected:SetCursor"是咋回事?
Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
?????????????????????????????????????????????????????????????????????