我正在尝试读取路径,然后打开文件,就像这样:
using namespace System;
using namespace System::Drawing;
string path;
cin >> path;
Bitmap ^image;
image = gcnew Bitmap( path );
它带有错误: “ System :: Drawing :: Bitmap :: Bitmap”与参数列表匹配 47个参数类型为:(std :: string)“
我不明白,因为这可以正常工作: image = gcnew Bitmap(“ sample_path”);
并且Bitmap具有带有String参数的构造函数,如Microsoft文档所述
https://docs.microsoft.com/pl-pl/dotnet/api/system.drawing.bitmap?view=dotnet-plat-ext-3.1
那么如何使用字符串加载位图?