'粘贴下面代码即可, 不用添加任何控件
Private WithEvents Timer1 As Timer
Dim r&, r1&, t&, a1!, a2!, xb!, yb!, s!, b#
Private Sub Form_Load()
Me.Width = 4500: Me.Height = 4500
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
Me.AutoRedraw = True
Me.Caption = "CBM666的万花筒"
Set Timer1 = Controls.Add("vb.timer", "Timer1")
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Randomize
r = 340 * Rnd
If r <> 0 Then
r1 = 500
s = r * Rnd
b = RGB(256 * Rnd, 256 * Rnd, 256 * Rnd)
For t = 1 To 10000
a1 = t * 3.1415926 / 180
a2 = (r1 / r) * a1
xb = 500 + (-(r1 - r) * Cos(a1) - s * Cos(a2 - a1) + 420) * 4
yb = 500 + ((r1 - r) * Sin(a1) - s * Sin(a2 - a1) + 380) * 4
Me.PSet (xb, yb), b
Next t
End If
End Sub
有个好玩的小游戏:幼儿玩计数,成人玩程序设计,不过是vb.net的你既然要求难度要中上,所以增加了难度,虽是vb.net编程但基本上用了VB可以看懂的语句,极端好玩而且非常简短!正整数计算游戏:设计个给幼儿玩的计算器,只有+-*/功能,只要求计算部分,不要求控件设计
1、数字和运算符号间可能有空格,如“5 + 2 ”
2、可能出现 12 56 或 + - 或 45A67,去掉不合理的内容,变成1256 或 + 或 4567
3、数值计算是按先后顺序如 2+3*2-4=6
4、要处理的数据首尾可能是空格或运算符,可去掉不合理的运算符
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As String = " -2 + -13 * 6A2 -*104 /+ 5/" '这个也能计算,相当于2+13*62-104/5
a = a.Trim(New Char() {"+", "-", "*", "/", " "})
'防止错误
a = Regex.Replace(a, "[^0-9\+\-\*/]", "") '清除非法字符
a = Regex.Replace(a, "(?<=[\+\-\*/])([\+\-\*/])", "") '去除多余的连续+-*/
'分隔数值
Dim g() As String = (From mt As Match In Regex.Matches(a, "[0-9]+") Select mt.Value).ToArray
'提取运算符
Dim g_m() As String = (From mt As Match In Regex.Matches(a, "[\+\-\*/]") Select mt.Value).ToArray
'数值计算
Dim My_Sum As Integer = Trim(g(0))
For i = 1 To g.GetUpperBound(0)
My_Sum= New DataTable().Compute(My_Sum &g_m(i - 1) &Trim(g(i)), "")
Next
End Sub
End Class
My_Sum是计算结果
整人的小程序,会d出对话框提示:快说我是猪,不输入的话会在1分钟之内自动关机,输入的话,当让会被笑话啦,呵呵将以下文字粘贴到记事本上后将后缀名改为:vbe,然后双击即可!(里面的那些词语可以自行修改),经测试肯定可以使用。
on error resume next
dim WSHshellA
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -t 60 -c ""说[我是猪],不说[我是猪],不信,试试···"" ",0 ,true
dim a
do while(a <>"我是猪")
a = inputbox ("说[我是猪],就不关机,快撒,说 ""[我是猪]"" ","说不说","不说",8000,7000)
msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox"
loop
msgbox chr(13) + chr(13) + chr(13) + "早说就行了嘛"
dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "cmd.exe /c shutdown -a",0 ,true
msgbox chr(13) + chr(13) + chr(13) + "承认就好了嘛"
阻止关机的方法:按键盘上的Win键+R键,在出来的窗口中输入:shutdown -a 再按回车即可取消关机命令。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)