Key idea: (1) Once we embed an image to an button (supposed it is named btn) by adding that image to its ImageList, to display an image, just use btn.ImageIndex = 0; //this is like to choose the first...

Just need shuffling part. rest has been done


Key idea: (1) Once we embed an image to an button (supposed it is named btn) by adding that image to its ImageList, to display an image, just use btn.ImageIndex = 0; //this is like to choose the first index (index 0) element in ImageList. If we do not want to display an image of button btn, just use btn.ImageIndex = -1; (2) How to compare two pictures, where the first one is put in ImageList of firstBtn, and the other one is put in ImageList of btn? Suppose when adding a picture to the ImageList of a button, we also add key for the image. Then the key is located in ImageList.Images.Keys[0] of that button.   Hints for writing code for b_click method for Memory Map game: In b_click method, we define what to do when btn is clicked.         When we click on a button btn,      If no first button of a new set of twins is chosen yet, that is, firstBtn is null,   begin           display its image (using code btn.ImageIndex = 0;)         set firstBtn to be btn, end otherwise (that is, there is a button shown with picture already, we need to find its twin) begin       If the current button btn has the same picture as firstBtn,       that is, ImageList.Images.Keys[0] of firstBtn and ImageList.Images.Keys[0] of btn are equivalent,       begin                disable firstBtn (set Enabled property of firstBtn to be false)                disable btn       end       else // firstBtn and btn are not twins        begin               do not display image of firstBtn by setting its ImageIndex to be -1               similarly, set ImageIndex of btn to be -1        end        set firstBtn to be null again (need to seek for a new pair of twins)     end
Dec 15, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here