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

How Do I Pass PictureBox and Label Through Functions?

本文关键字:Label PictureBox 何通过 函数      更新时间:2023-10-16

我在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)或下面的

要在函数中传递变量,必须使用指针。