我希望在窗口中显示个图片。
在创建Graphics类时,总是有多个构造函数重载。
以下是窗口过程的WM.PAINT下的代码段:
const WCHAR *filename = L"timg.jpg";
Image *image = Image::FromFile(filename);
Graphics g(image);
delete filename;
delete image;
在Graphics g(image)的image那里报错,说“有多个构造函数的实例与参数列表匹配”
下面列出
Graphics::Graphics(Image *image);
和Graphics::Graphics(<error-type> *graphics);
参数类型为(Image *)
我尝试过CSDN上的
Graphics g=Graphics.FromImage(image);语句,但是会在Graphics.FromImage的“.”前面报错:不允许使用类型名。
直接使用
Graphics::DrawImage(image,0,0);
又报错“非静态成员引用必须与特定对象相对”。后来发现DrawImage是动态成员不能用“::”。改成“.”之后又在“.”下面报错:应输入标识符。
我真没办法了,请教大佬来教教我。Please。