加图标的时候定义图标的宽度为列宽的一部分,列宽剩下的部分重新输出就行了。只用过dbgrid ,没用过dbgrideh,无法给出代码。
解决方案 »
- 谁在delphi中用过pdh指教一下?
- delphi调用.dbf数据库时,如何删除记录。删除后还在数据库中,只不过是加了上删除标记。
- 怎样取得像“%Windir%”、“%UserProfile%”这样的系统变量的实际路径?
- 就是隐藏不了qq的登陆窗口,有哪位高手请赐教,在下感激不进
- 谁能告诉我如何下载delphi7的补丁,送100分
- 我做了一个服务程序来启动另一个程序,但为什么被启动的程序只在进程中看到,没显示其界面?
- 各位DELPHI爱好者,我做了个多文挡程序,在每次点击菜单时关闭已经打开的所有窗体怎么做,谢谢帮忙!
- 如何提取图标
- 怎么解决播放midi 和wav 的冲突?
- 有谁知道delphi 5.0企业版升级包的密码?
- delphi怎么设置运行时显示的那一页是默认页
- 问下delphi中的三层是怎么分的,可以用三层访问Integer上的数据吗?
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
filename: string;
begin
if Pos('B', UpperCase(Column.FieldName)) > 0 then begin
filename := ExtractFilePath(Application.ExeName) + 'image\' + sstr + '.gif';
Image1.Picture.LoadFromFile(filename);
DBGrid1.Canvas.Draw(Rect.Left, Rect.Top, Image1.Picture.Graphic);
DBGrid1.Canvas.TextOut(Rect.Left + 32, Rect.Top + 2, 'TEST');
end;
end;
文字使用TextOUT显示
是改变了显示,虽然dataset中的数据没有改变,可是grid的怎么也没有改变,我点grid应该是grid的数据吧?
该列的ImageList设置为存放图标的ImagesList,NoInKeyListIndex设置为你要显示的图标的索引,ShowImageAndText设置为True。
ADOQuery1.SQL.Text:='select * from syscolumns';
ADOQuery1.Open;
with DBGridEh1.Columns[0] do//你要显示图标的列
begin
ImageList := ImageList1;
NotInKeyListIndex := 0;
ShowImageAndText := True;
end;