如何通过函数传递PictureBox和Label?

时间:2014-05-14 01:09:52

标签: c++ user-interface c++-cli

我在Visual Studio 2012的GUI环境中工作

void dealCard(PictureBox swag, Label swaggy)
{
    swag.Image = imageListCards->Images[deck[cardCounter].index];
    swaggy.Text = deck[cardCounter].name + " of " + deck[cardCounter].suit + ", " + deck[cardCounter].value;

    if(cardCounter == 51)
        cardCounter = 0;
    else
        cardCounter++;

}

void dealHand(PictureBox swag, PictureBox swag2, Label swaggy, Label swaggy2)
{
    dealCard(pictureBoxCard4, labelCard4);
    dealCard(pictureBoxCard5, labelCard5);
}   

pictureBoxCard4,labelCard4等已经在我正在使用的形式中。它没有编译部分dealCard(pictureBoxCard4,labelCard4)或下面的那个

1 个答案:

答案 0 :(得分:0)

要通过函数传递变量,必须使用指针。