问题描述
你好,
我有一个文本框.我在其中输入一些文字.
现在,我想在Datagridview中搜索该文本.
我也可以进行搜索,并突出显示该单元格.
但是问题是我不想突出整个单元格.我只想突出显示搜索文本框的文本.
如果我搜索"abc",并且如果我在DataGridview中找到它,那么我将更改该单元格的颜色.但是我只想突出显示"abc".不是整个细胞.
请帮帮我.
谢谢,
Viprat
Hello,
I have one textbox. In which i am enter some text.
Now i want to search that text in the Datagridview.
I am also able to search that and i am going to highlight that cell.
But the problem is that i don`t want to highlight whole cell. I want to high light only search textbox text.
If i search ''abc'' and if i found that in DataGridview then i am going to change the color of that cell. But i want to highlight only ''abc''. Not whole cell.
Please help me.
Thanks,
Viprat
推荐答案
string.Format("{0}{1}{2}"str_previous,
TextRenderer.DrawText(e.Graphics,"SearchText", this.Font,new Point(10, 10), SystemColors.ControlText),
str_end);
您可以使用上面的代码更新单元格文本.
希望它对您有用,
You can update your cell Text with above code.
Hope it works for you,
这篇关于Datagridview单元格中的高亮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!