在窗体中的DBGrid中有固定条数的记录,
我想在选中第一条记录的时候,DBGrid是整行被选中的,
即相当于DBGrid中Options中的dgRowSelect为True。
而在选中其他记录的时候,则只能选中某列的值,
相当于DBGrid中Options中的dgRowSelect为False。
我想在选中第一条记录的时候,DBGrid是整行被选中的,
即相当于DBGrid中Options中的dgRowSelect为True。
而在选中其他记录的时候,则只能选中某列的值,
相当于DBGrid中Options中的dgRowSelect为False。
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState);begin
if Table1.FieldByName('Size').AsFloat > 10 then
DBGrid1.Canvas.Font.Color := clRed;
DBGrid1.DefaultDrawDataCell(Rect, Field, State);
end;你只需要把Table1.FieldByName('Size').AsFloat > 10 改成Table1.RecNo = 1
DBGrid1.Canvas.TBrush.Color := clRed;
在afterscroll:
if adoquery1.recno=1 then
设置DBGrid中Options中的dgRowSelect为True
else
设置DBGrid中Options中的dgRowSelect为false
可是如何设置DBGrid中Options中的dgRowSelect为True或False呢?