private void dgvCaozuoList_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex == -1)//标题行
{
int X = e.CellBounds.X;
int Y = e.CellBounds.Y;
int W = e.CellBounds.Width;
int H = e.CellBounds.Height; Pen blackPen = new Pen(Color.FromArgb(195, 195, 195));//边框颜色 System.Drawing.Image image = Properties.Resources.tableheadbg;//背景图片
TextureBrush tBrush = new TextureBrush(image); e.Graphics.FillRectangle(tBrush, new System.Drawing.Rectangle(X, Y, W, H)); if (e.ColumnIndex == 0)
e.Graphics.DrawRectangle(blackPen, new System.Drawing.Rectangle(X, Y + 1, W - 1, H - 2));
else
e.Graphics.DrawRectangle(blackPen, new System.Drawing.Rectangle(X - 1, Y + 1, W, H - 2)); e.PaintContent(e.CellBounds);
e.Handled = true;
}
}
给 dgvCaozuoList增加了一个CellPainting的事件,事件中,把标题行重新绘制了一下,增加了背景图片。其中背景图片是我们导入到程序中的。而不能使用非导入的图片

最新文章

  1. javascript栈的建立样码
  2. java系统时间的调用和格式转换
  3. Confluence 5.4实现与JIRA前所未有的集成
  4. [转]Android事件分发机制完全解析,带你从源码的角度彻底理解(上)
  5. ORA-01034: ORACLE not available
  6. error: expected constructor, destructor, or type conversion before '.' token
  7. SSO 基于Cookie+fliter实现单点登录(SSO):工作原理
  8. 使用docker-compose 大杀器来部署服务 上
  9. ⑩bootstrap组件 导航 使用基础案例
  10. python3 判断字符串是否为纯空格组成的方法
  11. Redis数据结构之简单动态字符串SDS
  12. Linux ansible 之 playbook
  13. 计数排序与桶排序python实现
  14. ui-router实现返回上一页功能
  15. tensorflow入门指南
  16. 【洛谷】【计数原理+Floyed】P1037 产生数
  17. Android中注解的使用
  18. 二分算法的应用——最大化最小值 POJ2456 Aggressive cows
  19. 【08】循序渐进学 docker:docker compose
  20. todolist作业涉及知识点

热门文章

  1. 11、ON DUPLICATE KEY UPDATE实现插入更新操作
  2. 分享自己亲测过的Visualstudio 2019中开发Typescript时,设置自动编译生成js,无需手工运行命令生成的方法。
  3. [sklearn] 决策树、随机森林、隐马尔可夫模型
  4. css预处理器scss/sass语法以及使用
  5. Linux 查找某一线程是否已运行,并启动的方法
  6. vue中使用echarts来绘制中国地图,NuxtJS制作疫情地图,内有详细注释,我就懒得解释了,vue cli制作疫情地图 代码略有不同哦~~~
  7. 视图,触发器,存储过程,流程控制等MySQL小知识点
  8. 移动 WEB 开发之 阿里百秀移动端页面制作
  9. App测试Android的闪退总结
  10. java反序列化基础