https://www.codeproject.com/Articles/31823/RichTextBox-Cell-in-a-DataGridView-2

RichText是用图片显示的,当SelectionMode为FullRowSelect,图片背景颜色设置有bug。修改Paint方法解决:

        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, null, null, errorText, cellStyle, advancedBorderStyle, paintParts); bool selected = base.Selected;
if ((cellState | DataGridViewElementStates.Selected) == cellState)
{
selected = true;
} Image img = GetRtfImage(rowIndex, value, selected);//base.Selected if (img != null)
graphics.DrawImage(img, cellBounds.Left, cellBounds.Top);
}

  

最新文章

  1. flume中的agent配置和启动
  2. CSS中的class与id区别及用法
  3. 使用UG UISTYLER 窗体编辑器,创建对话框 part 2
  4. 一個相當簡潔的名字—Dyson Humidifier
  5. Gao Big 深圳行
  6. iBatis框架简介
  7. 通过登入IP记录Linux所有用户登录所操作的日志
  8. [原]Unity3D深入浅出 - 角色控制器(Character Controller)
  9. java中String类小结
  10. QT的信号与槽机制介绍
  11. MySql存储过程—3、变量
  12. 自定义ViewGroup实现垂直滚动
  13. 【web开发学习笔记】Structs2 Action学习笔记(两)
  14. Android 发展史
  15. JAVA RSA加密AES加密
  16. ORA-01654错误
  17. java class遍历属性
  18. 串口调试助手vc源程序及其详细编写过程
  19. 《 Spring1之第二次站立会议(重发)》
  20. wpf使用truetype字体ttf

热门文章

  1. FTP的主动模式与被动模式
  2. OllyDbg 使用笔记 (一)
  3. JSON之—— JSON.parse()和JSON.stringify() (插曲)
  4. angular - 启用form组件
  5. 国内云引擎平台概览——新浪SAE,阿里ACE,百度BCE
  6. MFC开发小技巧总结
  7. Leetcode Array 16 3Sum Closest
  8. Mode Standby
  9. 设计模式 - 代理模式(proxy pattern) 未使用代理模式 具体解释
  10. 把对象写入Postgresql中