初次使用dephi.像高手请教关于stringgrid 的问题。能否在stringgrid中插入图片?

jeking 2002-09-04 09:22:52
能否在stringgrid中插入图片?
如能,怎么插入。
谢谢!。
...全文
82 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
Patsy 2002-09-12
  • 打赏
  • 举报
回复
只要使用canvas就行了
zxjyi0820 2002-09-12
  • 打赏
  • 举报
回复
up
zrong 2002-09-12
  • 打赏
  • 举报
回复
谁说stringgrid不可以.
stringgrid1.Canvas.StretchDraw(rect,image1.picture.Bitmap);
super_jack 2002-09-12
  • 打赏
  • 举报
回复
The following code uses the bitmaps in an image list component to draw the contents of each cell in a draw grid. It draws a focus rectangle around the cell that has focus.

void __fastcall TForm1::DrawGrid1DrawCell(TObject *Sender, long Col, long Row, TRect &Rect, TGridDrawState State)

{
long index = Row * DrawGrid1->ColCount + Col;
DrawGrid1->Canvas->Brush->Color = clBackground;
DrawGrid1->Canvas->FillRect(Rect);
ImageList1->Draw(DrawGrid1->Canvas,Rect.Left,Rect.Top,index);
if (State.Contains(gdFocused))
DrawGrid1->Canvas->DrawFocusRect(Rect);
}

如果写在OnDrawCell事件里面就可以保持了!
super_jack 2002-09-12
  • 打赏
  • 举报
回复
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TRect rc;
TGridDrawState s;
rc=StringGrid1->CellRect(1,2);
ImageList1->Draw(StringGrid1->Canvas,rc.Left,rc.Top,2,true);
}
但是不能保存,刷新就没了!
zxjyi0820 2002-09-12
  • 打赏
  • 举报
回复
不过这样所有的grid都有图片!另外需要加入一些定位的的!!!!!!!
jeking 2002-09-04
  • 打赏
  • 举报
回复
现在很急,没空研究,谁能帮我!再加分!
dupenf 2002-09-04
  • 打赏
  • 举报
回复
没做过.五课星的高手,自己摸索一下就会了呀!! 呵呵!! 要是故意来送分,我可客气阿,哈哈
jeking 2002-09-04
  • 打赏
  • 举报
回复
那么DrawGrid怎么用?
我看继承的类。
stringgrid是从DrawGrid继承过来的呀。
ly_liuyang 2002-09-04
  • 打赏
  • 举报
回复
不可以的,只能用DrawGrid实现
jeking 2002-09-04
  • 打赏
  • 举报
回复
???
帮帮忙阿。
jeking 2002-09-04
  • 打赏
  • 举报
回复
高手呢?

5,392

社区成员

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

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