Posted by Graham Roberts on April 17, 2007I am programming a school project in delphi 4. It is a game based on the popular game "peg solitaire". So far it has went quite well. I have completed the HCI, the board (a delphi draw grid) is in place. Now, i need to "draw images to it". As it stands, i have it loading with the numbers 1, 2 and 0. 0 is blank as in not part of the board, 1 is a peg and 2 is a "hole"... as shown below:
[url=htp://kewlceo.com/forums/index.php?act=attach&type=post&id=266]Click Here For Screenshot[/url]
my code for this section is:
uses Unit2, Unit3, Unit4;
type boardarray= array[0..6,0..6] of byte; //activate board array
[quote]procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
DrawGrid1.Canvas.TextOut(Rect.Left, Rect.Top,inttostr(mainboard[ACol, ARow]));
I would like to replace the 0 with an image (image0.bmp), the 1 with an image (image1.bmp) and the 2 with an image (image 2.bmp), but havent got a clue what to do.
Hope one of you guys knows delphi and can help.
Cheers as always!