更改datagridview单元格中所选文本的前景色 [英] Change forecolor of selected text in datagridview cell
本文介绍了更改datagridview单元格中所选文本的前景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有datagridview列,其中包含Item Names和搜索texBox。我可以使用搜索文本在列中搜索项目。但问题是我想改变与搜索文本框文本匹配的datagridview单元格文本的forecolor。
I have datagridview column containing Item Names and search texBox. I am able to search items in columns using search text. But problem is that I want to change forecolor of datagridview cell text matching with search textbox text.
推荐答案
你想要三个链接,但最后一个是最重要的:
http:// msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.style.aspx [ ^ ] (彻底阅读备注部分),
http://msdn.microsoft.com/en-us/library/system .windows.forms.datagridviewcellstyle.aspx [ ^ ] ,
Microsoft Q209354 。
请不要冒犯,好?这就是你真正需要的东西:能够找到文档中的东西,特别是这些琐碎的东西。
请阅读自定义: http:// msdn .microsoft.com / zh-CN / library / ms171618%28v = vs.110%29.aspx [ ^ ]。
你可以渲染自定义图像单元格: http:// msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellpainting%28v=vs.80%29.aspx [ ^ ]。
使用System.Drawing.Graphics
的实例,绘制y部分文字:不同颜色的选定和未选择的部分。
-SA
You want exactly three links, but the last one is the most important:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.style.aspx[^] (read Remarks section thoroughly),
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.aspx[^],
Microsoft Q209354.
Please, no offense, OK? This is what you really need: the ability to find out things in documentation, especially such trivial things.
Please read on customization: http://msdn.microsoft.com/en-us/library/ms171618%28v=vs.110%29.aspx[^].
You can render custom image of the cell: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellpainting%28v=vs.80%29.aspx[^].
Using the instance ofSystem.Drawing.Graphics
, draw your text in parts: selected and unselected parts in different color.
—SA
你好专业,
i认为它会帮助你.....
http://stackoverflow.com/questions/12202751/how-can- i-make-a-datagridview-cells-font-a-specific-color [ ^ ]
这篇关于更改datagridview单元格中所选文本的前景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文