全部博文(788)
分类:
2009-05-12 16:04:35
去掉inherited试试
procedure TMakeTicket.DBGridEh3DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
inherited;
if Column.FieldName = 'Status' then
begin
with DBGridEh3.Canvas do
begin
FillRect(Rect);
case ADOQuery2.FieldByName('status').AsInteger of
1:TextRect(Rect,Rect.Left,((Rect.Bottom-Rect.Top)-TextHeight('处理')) div 2,'处理');
2:TextRect(Rect,Rect.Left,((Rect.Bottom-Rect.Top)-TextHeight('未处理')) div 2,'未处理');
end;
end else
DBGridEh3.DefaultDrawColumnCell(Rect, DataCol, Column, State);
1:TextRect(Rect,Rect.Left,((Rect.Bottom-Rect.Top)-TextHeight('处理')) div 2,'处理');
2:TextRect(Rect,Rect.Left,((Rect.Bottom-Rect.Top)-TextHeight('未处理')) div 2,'未处理');
============可以简洁点
1:TextOout(Rect.Left, Rect.Top+2,'处理');
2:TextOout(Rect.Left, Rect.Top+2,'未处理');
1:TextOout(Rect.Left+2, Rect.Top+2,'处理');
2:TextOout(Rect.Left+2, Rect.Top+2,'未处理');