Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.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
String 无法将参数1从基本字符串转换为字符串^_String_C++ Cli_Converter - Fatal编程技术网

String 无法将参数1从基本字符串转换为字符串^

String 无法将参数1从基本字符串转换为字符串^,string,c++-cli,converter,String,C++ Cli,Converter,我正在尝试使用windows窗体应用程序picturebox方法加载。我的代码如下: string image = "image.jpg"; pictureBox2->Size = System::Drawing::Size(36, 40); pictureBox2->Load(image); Controls->Add( pictureBox2); 但是,我发现以下错误: 'vo

我正在尝试使用windows窗体应用程序picturebox方法加载。我的代码如下:

            string image = "image.jpg";
            pictureBox2->Size = System::Drawing::Size(36, 40);
            pictureBox2->Load(image);
            Controls->Add( pictureBox2);
但是,我发现以下错误:

'void System::Windows::Forms::PictureBox::Load(System::String ^)' : cannot convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'System::String ^'
知道如何将字符串转换为字符串吗?

简单使用:

String ^image = "image.png";
加载一个托管字符串。

这应该可以做到:

std::string image("image.png");
String^ MyString = gcnew String(image.c_str());

图像名称为exmaple。我使用dirent.h从dir加载文件并将其存储在vector中。将向量更改为向量是否有变化?