Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何通过函数传递PictureBox和Label?_C++_User Interface_C++ Cli - Fatal编程技术网

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

C++ 如何通过函数传递PictureBox和Label?,c++,user-interface,c++-cli,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].va

我在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等已经以我正在使用的形式出现。它不是在编译part dealCard(pictureBoxCard4,labelCard4)或者下面的一个

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

Jesse_BlackJack2::MyForm::dealCard”:无法将参数1从“System::Windows::Forms::PictureBox^”转换为“System::Windows::Forms::PictureBox”c:\users\Jesse martinez\documents\visual studio”2012\projects\jesse_blackjack2\jesse_blackjack2\MyForm.h 1538 1 jesse_blackjack2我是否必须使用指针或其他东西来完成我试图做的事情?您应该编辑问题以包含错误,并可能添加c++-cli标记以提高可见性。我不使用托管C++,但我会从错误消息中假设您打算将这些消息作为句柄传递。您必须学会如何正确地使用如图框和标签之类的引用类型。有很多关于C++/CLI的教程和书籍,你不需要我们的帮助就可以阅读它们。我无法通过谷歌搜索找到答案。你能给我指一下正确的方向吗?底部提到在函数中使用指针。希望这有帮助。没有帮助,因为我正在使用C++/CLI