• Advertisement

Archived

This topic is now archived and is closed to further replies.

Does any know how to put images in a TDrawGrid In C++ Builder?

This topic is 5264 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings! I am trying to make a RPD 2D Tile-base Map Editor Similar to RPG Maker 95/98/2000/2003. I''ve also posted previously with my source code here: http://gamedev.net/community/forums/topic.asp?topic_id=175379 If anybody can figure out the problem in either Delphi or C++ Builder it would be helpfull. I don''t Pascal or Delphi we''ll but I do understad enough of it to convert it to c++ just by looking at Delphi code. Just because some one is new to something does not me that they shoud not try to do something big with it, after all trail and error is what build experence and experence built is experence gain.

Share this post


Link to post
Share on other sites
Advertisement
Oh and I move the code to ondrawcell event

Just because some one is new to something does not me that they shoud not try to do something big with it, after all trail and error is what build experence and experence built is experence gain.

Share this post


Link to post
Share on other sites
here you go ( in delphi )

procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
DrawGrid1.Canvas.StretchDraw(Rect,Image1.Picture.Bitmap);
end;

Hope it helps

Mark.

Share this post


Link to post
Share on other sites
I looked at your code and I think your problem is you are drawing it in the OnDrawCell event. You shouldn''t draw all of the cells, just the one that is updating. Or move your drawing into a timer or something. Or you could do it during the OnIdle event of TApplication.

Share this post


Link to post
Share on other sites
I just saw your post at bytamin-c.

Post some code about your saving function, since that is what is crashing your editor.

Share this post


Link to post
Share on other sites
C++ Builder would Crash when ever I attempt to save the project when the TImageList width is 192 and height is 1024. I''m going to try it with delphi too

Share this post


Link to post
Share on other sites
There might be an internal limit that the image list supports for it''s images sizes. Search borland''s site to see if you can come up with anything.

Why not just get rid of the ImageList and use a linked list instead to store the bitmaps? That way you have more control over the info for each image. This is what I do for my map editor. Builder has a great linked list class, TList, that makes this very easy.

Share this post


Link to post
Share on other sites

  • Advertisement