delphi Dbgrid隔行数据显示奇偶色

来源:互联网 发布:excel中查找重复数据 编辑:程序博客网 时间:2024/05/19 23:27

目标:Dbgrid隔行数据显示奇偶色

DBGrid1DrawColumnCell 事件:var  RowHeight,Row:INteger;begin  RowHeight := Rect.Bottom - Rect.Top + 1;       //Rect矩形  Row := (Rect.Top div RowHeight);  if  row mod 2 = 0 then    begin      dbgrid1.Canvas.Brush.Color:=cl3Dlight;      dbgrid1.Canvas.Font.Color:=clBlack;    end;   dbgrid1.DefaultDrawColumnCell(rect,datacol,column,state);end;


0 0
原创粉丝点击