http://community.csdn.net/Expert/topic/5008/5008093.xml?temp=.7011835
让关键字的颜色不一样.达到突出显示的目的.
如:select * from tablename
让select 和from 变成蓝色.而其它的字是黑色的.
环境:NET2003,C#,WINDOWS应用程序.laladeng() ( ) 信誉:100 Blog 2006-9-8 12:58:42 得分: 35
自己看看效果吧,只是一个思路
richTextBox1内容设为“Select ID From MyTable”
private void button1_Click(object sender, System.EventArgs e)
{
int i = this.richTextBox1.Find("Select");
this.richTextBox1.Select(i,6);
this.richTextBox1.SelectionColor = Color.Red;
i = this.richTextBox1.Find("From");
this.richTextBox1.Select(i,4);
this.richTextBox1.SelectionColor = Color.Blue;
}
再问:现在因为我要每输入一个字都要检查一遍,用这种方法虽然能实现,但是会让字先选中,再变色,看起来一闪一闪的.谁还有什么好办法吗?
让关键字的颜色不一样.达到突出显示的目的.
如:select * from tablename
让select 和from 变成蓝色.而其它的字是黑色的.
环境:NET2003,C#,WINDOWS应用程序.laladeng() ( ) 信誉:100 Blog 2006-9-8 12:58:42 得分: 35
自己看看效果吧,只是一个思路
richTextBox1内容设为“Select ID From MyTable”
private void button1_Click(object sender, System.EventArgs e)
{
int i = this.richTextBox1.Find("Select");
this.richTextBox1.Select(i,6);
this.richTextBox1.SelectionColor = Color.Red;
i = this.richTextBox1.Find("From");
this.richTextBox1.Select(i,4);
this.richTextBox1.SelectionColor = Color.Blue;
}
再问:现在因为我要每输入一个字都要检查一遍,用这种方法虽然能实现,但是会让字先选中,再变色,看起来一闪一闪的.谁还有什么好办法吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货