g-w-r Posted April 17, 2007 Posted April 17, 2007 I 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: Click Here For Screenshotmy code for this section is:mplementation{$R *.DFM}uses Unit2, Unit3, Unit4;type boardarray= array[0..6,0..6] of byte; //activate board arrayconstmainboard:boardarray=( (0,0,1,1,1,0,0), (0,0,1,1,1,0,0), (1,1,1,1,1,1,1), (1,1,1,2,1,1,1), (1,1,1,1,1,1,1), (0,0,1,1,1,0,0), (0,0,1,1,1,0,0)) ;andprocedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);beginDrawGrid1.Canvas.TextOut(Rect.Left, Rect.Top,inttostr(mainboard[ACol, ARow]));end;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!-Graham
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now