今天我用c#编的记事本的程序一运行机子就死机了~~~~~~有时导致机子重启~~~~~~主要有如下的症状:
1.在richtextbox1中输入a并不断的回车直到出现滚动条。然后想用鼠标点击滚动条查看一下文本,但是滚动了不到十分之一滚动条就卡住不动了。再点击它机子就会发出吱吱的警报声~~~~~~~~~~~谢谢大家了~~~~~~~~~~~~~~~~

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace 透明笔记本
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private void toolStripButton1_Click(object sender, EventArgs e)
            {
                openFileDialog1.ShowDialog();        }        private void toolStripButton2_Click(object sender, EventArgs e)
            {
                saveFileDialog1.ShowDialog();        }        private void toolStripButton3_Click(object sender, EventArgs e)
            {
                saveFileDialog2.ShowDialog();
            }       
            private void 帮助主题ToolStripMenuItem_Click(object sender, EventArgs e)
            {   
                Form2 f2 = new Form2();
                f2.Visible = false;
               while (帮助主题ToolStripMenuItem.Checked = !帮助主题ToolStripMenuItem.Checked)
                {                f2.Visible =true;
                }
            }        private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                openFileDialog1.ShowDialog();
            }        private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                saveFileDialog1.ShowDialog();
            }        private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                saveFileDialog2.ShowDialog();
            }        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }        private void toolStripButton4_Click(object sender, EventArgs e)
            {
                string text = richTextBox1.SelectedText;
                Clipboard.SetDataObject(text);        }        private void 复制ToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                string text = richTextBox1.SelectedText;
                Clipboard.SetDataObject(text);
            }        private void 粘贴ToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                IDataObject data = Clipboard.GetDataObject();
                if (data.GetDataPresent(DataFormats.Text))
                {
                    richTextBox1.SelectedText = data.GetData(DataFormats.Text).ToString();
                }
                else
                {
                    MessageBox.Show("数据不是文本格式");
                
                }
            }        private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.SelectedText = " ";
            }        private void 时间日期ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.SelectedText = DateTime.Now.ToLongDateString();
            }        private void 状态栏ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                statusStrip1.Visible = false ;
               
              if ( 状态栏ToolStripMenuItem.Checked = !状态栏ToolStripMenuItem.Checked)
              {  statusStrip1.Visible = true ; }
               
               
            }        private void 复制ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                string text = richTextBox1.SelectedText;
                Clipboard.SetDataObject(text);
            }        private void 删除ToolStripMenuItem1_Click(object sender, EventArgs e)
            {
                richTextBox1.SelectedText = " ";
            }        private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                IDataObject data = Clipboard.GetDataObject();
                if (data.GetDataPresent(DataFormats.Text))
                {
                    richTextBox1.SelectedText = data.GetData(DataFormats.Text).ToString();
                }
                else
                {
                    MessageBox.Show("数据不是文本格式");            }        }        private void 字体ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                fontDialog1.ShowDialog();
                richTextBox1.Font = fontDialog1.Font;
                richTextBox1.ForeColor = fontDialog1.Color;        }        private void toolStripButton5_Click_1(object sender, EventArgs e)
            {
                IDataObject data = Clipboard.GetDataObject();
                if (data.GetDataPresent(DataFormats.Text))
                {
                    richTextBox1.SelectedText = data.GetData(DataFormats.Text).ToString();
                }
                else
                {
                    MessageBox.Show("数据不是文本格式");            }
            }        private void toolStripButton6_Click(object sender, EventArgs e)
            {
                richTextBox1.SelectedText = " ";
            }        private void toolStripButton7_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }
        }
    }第二个FORM2
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace 透明笔记本
    {
        public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
            }
           private void Form2_Load(object sender, EventArgs e)
            {
            }
           
           private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
                   {
                       this.Visible = false;
                    }
            
           
        }
    }