| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1811 人关注过本帖
标题:求助各位前辈,一定要帮我!
只看楼主 加入收藏
lzxiaoniu
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-11-10
结帖率:0
收藏
已结贴  问题点数:20 回复次数:15 
求助各位前辈,一定要帮我!
刚开始学习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
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
收藏
得分:1 
哪里不懂,直接说出来.

将代码拷过去,直接按F5,不就可以看到效果了么?

飘过~~
2009-11-10 17:52
jedypjd
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:9
帖 子:1096
专家分:4969
注 册:2009-7-27
收藏
得分:1 
            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(); //用文件流打开任务管理器应用程序而不关闭文件流就会阻止打开任务管理器 

这个强啊,学到了  

天涯无岁月,歧路有风尘,百年浑似醉,是非一片云
2009-11-10 18:09
jedypjd
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:9
帖 子:1096
专家分:4969
注 册:2009-7-27
收藏
得分:0 
估计他没装VS呢

天涯无岁月,歧路有风尘,百年浑似醉,是非一片云
2009-11-10 18:12
乖老鼠
Rank: 5Rank: 5
来 自:四川省
等 级:职业侠客
威 望:2
帖 子:434
专家分:394
注 册:2008-9-8
收藏
得分:1 
这个有意思呢

转眼就从编程菜鸟混成了半灌水
2009-11-10 18:17
ghl2312
Rank: 4
等 级:业余侠客
威 望:2
帖 子:208
专家分:226
注 册:2008-7-10
收藏
得分:1 
回复 5楼 乖老鼠
老鼠终于冒泡了啊

向灰太狼学习
2009-11-10 19:58
zhaoxili
Rank: 6Rank: 6
等 级:侠之大者
威 望:1
帖 子:327
专家分:479
注 册:2009-1-3
收藏
得分:1 
建立个FROM  然后把代码copy 运行就可以了啊
2009-11-10 20:26
baikil
Rank: 10Rank: 10Rank: 10
来 自:X星球
等 级:青峰侠
威 望:4
帖 子:282
专家分:1580
注 册:2009-7-20
收藏
得分:1 
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_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 = "";
                }
            }
        }
这个不是对他所说的做后的效果处理..
他叫你按Alt+F4---->这里就对Alt+F4屏蔽
  
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();
        }
这个就是你为什么打开不了任务管理器的原因..
有MyFs对taskmgr.exe的读取..这样文件流不关闭就没有启动taskmgr.exe


这程序主要用到了:文件流操作,警告大家对文件流用完要关闭.
                进程的启动,可以做个自动打开某程序,网页...还好玩的
                键盘事件处理,KeyDown来截接输入的信息..


自创QQ群64885635,方便C#学习交流.希望各项工作路好学都好入!
2009-11-11 08:48
lzxiaoniu
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-11-10
收藏
得分:0 
先谢了上面各位热心前辈,我的意思是有了别人的代码,如何能够演示其代码产生的效果,上面的代码只是随意找来的做为例子。我在VS2005中COPY 了,但是不行啊。
2009-11-11 09:00
yjy1987420
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:39
专家分:120
注 册:2009-9-14
收藏
得分:1 
你不是没加控件吧。
2009-11-11 17:27
快速回复:求助各位前辈,一定要帮我!
数据加载中...
 
   



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

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