3种颜色可选择,先选择输入字体的颜色之后再输入文字,用哪个来实现?如何实现?
请注意是先选择颜色之后再选择输入的文字.

解决方案 »

  1.   

    先选中要设置的文本,通过设置rt.SelectionBackColor;及rt.SelectionColor来改变显示颜色。
    private void rtx_TextChanged(object sender, EventArgs e)  //文本框改变事件
             {
                int index = this.rtx.SelectionStart;    //记录修改的位置
                  this.rtx.SelectAll();
                this.rtx.SelectionColor = Color.Red;            this.rtx.Select(index, 0);     
                  this.rtx.SelectionColor = Color.Black;        }
      

  2.   


    一般涉及比较多的时候用richtextbox