怎样将数据库中存放着的JPG图像画到StringGrid中的指定的单格?

haoco 2003-04-25 01:36:00
如题
...全文
28 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sixgj 2003-04-26
  • 打赏
  • 举报
回复
??
snake_eye 2003-04-26
  • 打赏
  • 举报
回复
tdrawgrid
haoco 2003-04-25
  • 打赏
  • 举报
回复
我要的是JPG格式的
boz 2003-04-25
  • 打赏
  • 举报
回复
下面的程序可以在StringGrid中显示ImageList中的图形,不过是Bmp的格式,
您可以编程转换一下就行了


使用TStringGrid的OnDrawCell事件
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;Rect: TRect; State: TGridDrawState);
var
 index: integer;
begin
 //确定从ImageList中的图形的索引号
 index := ARow * (Sender as TStringGrid).ColCount + ACol;

 with Sender as TStringGrid do
 begin
  //填充背景
  Canvas.Brush.Color := clBackGround;
  Canvas.FillRect(Rect);

  //把imageList的图形显示在StringGrid中
  ImageList1.Draw(Canvas,Rect.Left,Rect.Top,index);

  if gdFocused in State then
   Canvas.DrawFocusRect(Rect);
 end;

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧