if ((State=[gdSelected])or(State=[gdSelected,gdFocused])) then
begin
DbGrid1.Canvas.Brush.color:=clred;
//file://当前行以红色显示,其它行使用背景的浅绿色
//DbGrid1.Canvas.pen.mode:=pmmask;
DbGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
然后将DBGRID的option dgrowselect 设成true这样可以实现选定行全是红色,但是有得字段的PICKLIST的值无法进行下拉的选择??
不知道有解决的办法吗??
begin
DbGrid1.Canvas.Brush.color:=clred;
//file://当前行以红色显示,其它行使用背景的浅绿色
//DbGrid1.Canvas.pen.mode:=pmmask;
DbGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
然后将DBGRID的option dgrowselect 设成true这样可以实现选定行全是红色,但是有得字段的PICKLIST的值无法进行下拉的选择??
不知道有解决的办法吗??
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if (DBGrid1.SelectedField = Field) and (gdfocused in State) then
begin
Edit1.Visible := True;
Edit1.SetBounds(DBGrid1.Left+rect.Left,DBGrid1.Top+ Rect.Top,Rect.Right-rect.Left,Rect.Bottom-rect.Top);
Edit1.Text := Field.AsString;
end;
end;