Delphi DBGrid图显用法
2016-03-01 10:54
525 查看
procedure TForm10.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var Im1: TBitmap;
staff_id: string;
begin
Im1:=TBitmap.Create;
if (dm.AQ_personal.RecordCount = 0) then exit;
if Column.Field = dm.AQ_personal.FindField('autoid') then
// if Column.Field = dm.AQ_personal.FindField('工号') then
begin
with DBGrid1.Canvas do
begin
Brush.Color:=clinfoBk;
FillRect(Rect);
staff_id:=dm.AQ_personal.FindField('staff_id').Asstring;
if ((dm.AQ_personal.FindField('work_type').Asstring)='离职类别')
then ImageList2.GetBitmap(0,Im1);
if ((dm.AQ_personal.FindField('work_type').Asstring)='试用期员工')
then ImageList2.GetBitmap(1,Im1);
if ((dm.AQ_personal.FindField('work_type').Asstring)='未填在离职')
then ImageList2.GetBitmap(2,Im1);
if ((dm.AQ_personal.FindField('work_type').Asstring)='在职类别')
then ImageList2.GetBitmap(3,Im1);
// TextOut(Rect.Right-2-DBGrid1.Canvas.TextWidth(staff_id),Rect.Top+1,staff_id);
// Draw(round((Rect.Left+Rect.Right-Im1.Width)/5),Rect.Top,Im1);
Draw(round((Rect.Left+Rect.Right-Im1.Width)/2),Rect.Top,Im1);
end;
end; end;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var Im1: TBitmap;
staff_id: string;
begin
Im1:=TBitmap.Create;
if (dm.AQ_personal.RecordCount = 0) then exit;
if Column.Field = dm.AQ_personal.FindField('autoid') then
// if Column.Field = dm.AQ_personal.FindField('工号') then
begin
with DBGrid1.Canvas do
begin
Brush.Color:=clinfoBk;
FillRect(Rect);
staff_id:=dm.AQ_personal.FindField('staff_id').Asstring;
if ((dm.AQ_personal.FindField('work_type').Asstring)='离职类别')
then ImageList2.GetBitmap(0,Im1);
if ((dm.AQ_personal.FindField('work_type').Asstring)='试用期员工')
then ImageList2.GetBitmap(1,Im1);
if ((dm.AQ_personal.FindField('work_type').Asstring)='未填在离职')
then ImageList2.GetBitmap(2,Im1);
if ((dm.AQ_personal.FindField('work_type').Asstring)='在职类别')
then ImageList2.GetBitmap(3,Im1);
// TextOut(Rect.Right-2-DBGrid1.Canvas.TextWidth(staff_id),Rect.Top+1,staff_id);
// Draw(round((Rect.Left+Rect.Right-Im1.Width)/5),Rect.Top,Im1);
Draw(round((Rect.Left+Rect.Right-Im1.Width)/2),Rect.Top,Im1);
end;
end; end;
相关文章推荐
- 一个简单的MDI示范程序(Delphi)
- DELPHI如何调用存储过程
- delphi 中如何调用sql 存储过程
- Delphi Length函数
- Delphi 7 调用 C# WebService
- Delphi一共封装(超类化)了8种Windows基础控件和17种复杂控件
- Delphi基本图像处理方法汇总
- Delphi制作图像特殊显示效果
- delphi的TThread.CreateAnonymousThread导致界面卡死
- Delphi XE6 String转MemoryStream
- Delphi TXLSReadWriteII 导出EXCEL
- delphi:斑马打印机ZPL指令打印中文及二维码,补充说明
- delphi 怎么将一个流转换成字符串?或者将字符串转出一个流
- DELPHI实现百度开放平台
- delphi7 经过测试的 md5 加密解密
- Delphi函数详解:全局函数,内部函数,类的成员函数,类的静态方法
- 图书馆管理系统
- Delphi的TListView控件拖放选定行操作
- Delphi 文件处理(2)
- Delphi中限制文本框(TEdit)只能输入数字