String 无法将参数1从基本字符串转换为字符串^
我正在尝试使用windows窗体应用程序picturebox方法加载。我的代码如下: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
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中。将向量更改为向量是否有变化?