Beispiel #1
0
        //结束指定线程
        private void StopThread()
        {
            if (lvwThread.SelectedItems.Count > 0)
            {
                try
                {
                    int           id     = Convert.ToInt32(lvwThread.SelectedItems[0].Text);
                    ProcessThread thread = curThreads[id];
                    thread.Dispose();

                    RefreshDisplay();
                }
                catch (Exception e)
                {
                    MessageBox.Show("无法关闭此线程!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("请选中一个线程!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }