标签:style http color 使用 os strong io for
〇、下载地址
本程序可以在 这里 下载到。
一、关于本游戏的玩法
1)刚进程序,会有一个提示性的窗体,单击“开始测试”按钮正式进入游戏
2)正式进入游戏窗体后,当鼠标挪向按钮“不是”后,按钮“不是”上的字样会变成“是”,而原来的按钮“是”上面会显示“不是”。点击两个按钮的任意一个后,都会被程序“羞辱”,然后程序会自动退出。
3)不要试图通过打开右上角的X或是用任务管理器(taskmgr)关闭这个窗口,如果你真的想关闭这个程序还不想承认自己是XX,请使用命令行。
4)你可以用这个程序去搞一些恶作剧,还是那句话:Just For Fun :-P
二、程序控件与代码
1)窗体FormMain
窗体属性:
StartPosition(初始位置) |
CenterScreen |
MaximizeBox(最大化按钮) |
False |
MinimizeBox(最小化按钮) | False |
FormBorderStyle(窗体风格) |
FixedSingle |
窗体代码
Public Class FormMain Private Sub btnTest_Click(sender As Object, e As EventArgs) _ Handles btnTest.Click Me.Hide() FormTest.ShowDialog() End Sub End Class
2)窗体FormTest
窗体属性:
StartPosition(初始位置) | CenterScreen |
MaximizeBox(最大化按钮) | False |
MinimizeBox(最小化按钮) | False |
FormBorderStyle(窗体风格) | Fixed3D |
ShowIcon(显示图标) |
False |
ShowInTaskbar(在任务栏出现) |
False |
窗体代码:
Public Class FormTest ‘选择“是”或“不是”后该布尔值会变成True,此时窗口可关闭 Dim isChoosen As Boolean = False ‘上方的Panel采用渐近色处理 Private Sub pnlTop_Paint(sender As Object, e As PaintEventArgs) _ Handles pnlTop.Paint Using LG As Drawing2D.LinearGradientBrush = New Drawing2D.LinearGradientBrush( New Point(0, 0), New Point(0, Me.Height), Color.FromArgb(192, 192, 255), Color.White) e.Graphics.FillRectangle(LG, New Rectangle(0, 0, Me.Width, Me.Height)) End Using End Sub Private Sub FormTest_Load(sender As Object, e As EventArgs) _ Handles MyBase.Load ‘鼠标移到右侧按钮,则按钮上文字变化 AddHandler btnRight.MouseEnter, Sub(obj As System.Object, arg As System.EventArgs) btnRight.Text = "是" btnLeft.Text = "不是" End Sub ‘鼠标移出右侧按钮,则按钮上文字变回原样 AddHandler btnRight.MouseLeave, Sub(obj As System.Object, arg As System.EventArgs) btnRight.Text = "不是" btnLeft.Text = "是" End Sub ‘鼠标按下按钮,如果按钮上文字为“是”则弹出MessageBox AddHandler btnLeft.MouseClick, Sub(obj As System.Object, arg As System.EventArgs) Dim btnTemp As Button = DirectCast(obj, Button) If btnTemp.Text = "是" Then MessageBox.Show("我就知道你会选是的") isChoosen = True Application.Exit() End If End Sub ‘鼠标按下按钮,如果按钮上文字为“是”则弹出MessageBox AddHandler btnRight.MouseClick, Sub(obj As System.Object, arg As System.EventArgs) Dim btnTemp As Button = DirectCast(obj, Button) If btnTemp.Text = "是" Then MessageBox.Show("我就知道你会选是的") isChoosen = True Application.Exit() End If End Sub ‘计时器:禁止打开任务管理器 Dim tmr As New Timer AddHandler tmr.Tick, Sub(obj As System.Object, arg As System.EventArgs) Dim pArray As Process() = Process.GetProcesses For Each p As Process In pArray Try If p.ProcessName.ToLower.Trim = "taskmgr" Then p.Kill() MessageBox.Show("小伙你不觉得你很逗么?") ‘将本窗口放到最前 Me.TopMost = True Me.TopMost = False Return End If Catch ex As Exception Return End Try Next End Sub tmr.Interval = 200 tmr.Enabled = True tmr.Start() End Sub ‘关闭窗口事件 Private Sub FormTest_FormClosing(sender As Object, e As FormClosingEventArgs) _ Handles MyBase.FormClosing ‘如果没有选择禁止关闭窗口 If isChoosen = False Then MessageBox.Show("关了我也改变不了事实,你还是选一个吧") e.Cancel = True Return End If Me.Hide() Threading.Thread.Sleep(3000) MessageBox.Show( "This game is just for fun! Thx 4 playing." & vbCrLf & _ " -Tsybius 2014年8月1日 13:37:35") End Sub End Class
END
游戏“你是XX么”的VB.NET实现,布布扣,bubuko.com
标签:style http color 使用 os strong io for
原文地址:http://my.oschina.net/Tsybius2014/blog/297266