0

I'm writing a Windows Form card game and am having trouble assigning an image to my cards. When I debug my code below, the method seems to return unexpectedly as soon as it reaches the GetObject method. Am I using this method improperly? If so, can anyone provide a better solution?

private void initCards()
    {
        ResourceManager rm = new ResourceManager(typeof(Image));       
        for (int i = 0; i < 4; i++)
        {
            for (int j = 102; j < 115; j++)
            {
                int tempId = j + (i * 100);
                Card tempCard = new Card(tempId);
                object obj = rm.GetObject("card"+tempId);
                int x = 12;
                tempCard.setImage((Image)obj);
                deck.Add(tempCard);
            }
        }
    }
4

0 回答 0