扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:务实 来源:天极网 2007年10月14日
关键字:
Private Sub Form-KeyDown(KeyCode As Integer,Shift As Integer) X=ShowCursor(True) End EndSub |
Form BackColor=&H80000007& BorderStyle=0 ’None MaxButton=False MinButton=False Windowstate=2 ’Maximized Timer Intelval=5 PictureBox BackColor=&H80000007& BorderStyle=0 ’None AutoSize=Ture |
’在窗体的声明部分声明ShowCursor函数。 Private Declare Function ShowCursor Lib“user32”(By Val bShow As Long) As Long ’在窗体上单击鼠标时退出程序 Private Sub Form-Click() X=ShowCursor(True) End EndSub ’在窗体上按下按键时退出程序 Private Sub Form-KeyDown(KeyCode As Integer,Shift As Integer) X=ShowCursor(True) End EndSub ’加载窗体时隐藏鼠标 Private Sub Form-Load() Dim X As Long X=ShowCursor(False) Picture1.Visible=False Picture1.PICTure=LoadPICTure(“C:\windows\PIC.BMP”) Picture1.Left=-Picture1.Width EndSub ’在窗体上移动鼠标时退出程序 Private Sub Form-MouseMove(Button As Integer,Shift As Integer,X As Single,Y As Single) Static currentX,currentY As Single Dim orignX,orignY As Single ’把当前的鼠标值赋给orignX和orignY orignX=X orignY=Y ’初始化currentX和currentY If currentX=0 And currentY=0 Then currentX=orignX currentY=orignY ExitSub EndIf If Abs(orignX-currentX)>1 Or Abs(orignY-currentY)>1 Then X=ShowCursor(True) End EndIf EndSub Private Sub Picture1-Click() X=ShowCursor(True) End EndSub Private Sub Picture1-KeyDown(KeyCode As Integer,Shift As Integer) X=ShowCursor(True) End EndSub Private Sub Picture1-MouseMove(Button As Integer,Shift As Integer,X As Single,Y As Single) Static Xlast,Ylast As Single Dim Xnow,Ynow As Single Xnow=X Ynow=Y If Xlast=0 And Ylast=0 Then Xlast=Xnow Ylast=Ynow ExitSub EndIf If Abs(Xnow-Xlast)>1 Or Abs(Ynow-Ylast)>1 Then X=ShowCursor(True) End EndIf EndSub Private Sub Timer1-Timer() Picture1.Visible=True Picture1.Top=(Form1.Height-Picture1.Height)/2 Picture1.Left=Picture1.Left+50 If Picture1.Left>Form1.Width Then Picture1.Left=-Picture1.Width EndIf EndSub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。