1,如果想令dbgrideh(或者是dbgrid)表格的第三行高亮显示,该怎么编写代码?
(如果将options---dbrowselect属性设为true,可以选中一整行,且该行呈蓝色)
我要的就是这种效果,请问如何实现??2,怎么查找dbgrideh(或dbgrid)表格的哪一行正在高亮显示?(必须是高亮显示)                                                      谢谢!!!

解决方案 »

  1.   

    在DAGAGRID的ItemDataBound事件里,If e.Item.ItemIndex = 2 Then
      

  2.   

    对不起,看错了,还以为是ASP.NET
      

  3.   

    第一个问题:
    procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    begin
      if form1.Table1.RecNo=3 then
        form1.DBGrid1.Canvas.Brush.Color:=clblue;
      form1.DBGrid1.Canvas.Pen.Mode:=pmmask;
     if not form1.DBGrid1.SelectedRows.CurrentRowSelected then
        form1.DBGrid1.DefaultDrawColumnCell(rect,datacol,column,state);
    end;