首页  编辑  

复制、粘贴、剪切状态判断

Tags: /C#/界面处理/TextBox_RichEdit/   Date Created:

private void Form1_Load( object sender , EventArgs e)

{

    Application . Idle += new EventHandler (Application_Idle);

}

void Application_Idle( object sender , EventArgs e)

{

   buttonCopy . Enabled = textBox1 . SelectionLength > 0 ;

   buttonCut . Enabled = textBox1 . SelectionLength > 0 ;

   buttonPaste . Enabled = Clipboard . ContainsText();

}