通过百度网盘分享的文件:Sqlite框架Delphi10.3 (3).rar
链接:https://pan.baidu.com/s/1kQzFwnnAx-vG_E5CB5kHXg
提取码:gie7
会覆盖 FDQuery1idGetText 文本显示
procedure TForm13.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var LGrid :TDBGrid; LText:string; LTextWidth:tsize; begin//=====================================id================================== if Column.FieldName.Equals('id') then begin LGrid :=TDBGrid(Sender); LGrid.Canvas.Brush.Style := bsSolid; LGrid.Canvas.FillRect(Rect); LGrid.Canvas.Font.Size := LGrid.Font.Size - 1; LGrid.Canvas.Font.Color := clWhite; LGrid.Canvas.Brush.Color := clYellow; //进度 背景颜色 LGrid.Canvas.RoundRect(Rect.Left, Rect.Top , Trunc(Rect.Left + Column.Field.AsFloat / 12 * Rect.Width) //分母 , Rect.Bottom, 2, 2); Rect.Inflate(-1, -1); LGrid.Canvas.Pen.Style := psClear; LGrid.Canvas.Font.Color := clRed; // 字体颜色 LGrid.Canvas.Brush.Style := bsClear; LText := FormatFloat('##0', Column.Field.AsFloat) + ' %'; LTextWidth := LGrid.Canvas.TextExtent(LText); LGrid.Canvas.TextOut(Rect.Left + ( (Rect.Width div 2) - (LTextWidth.cx div 2)), Rect.Top + ((Rect.Height div 2) - (LTextWidth.cy div 2)), LText); end; //================================================================= end;