代码改成
static ptime As Date = Nothing
static presult As Boolean = False
Dim sp As TimeSpan = Date.now - ptime
ptime = Date.now
If sp.TotalMilliseconds < 2000 Then '间隔2秒点击才有效
e.cancel = presult
Return
End If
If User.Name = "游客" Then
e.Cancel = True
presult = True
MessageBox.Show("您是游客,只能看哦.", "提示")
Else
presult = False
End If