//装入图形文件 Image image(WCHAR(strOpenFileName.GetBuffer(strOpenFileName.GetLength())));
Point destPoints[3] = { Point(0, 0), Point(image.GetWidth(), 0), Point(0, image.GetHeight()) }; 编译时出现如下错误:请问高手怎么解决?(在线等 3Q!):\Project\ImageShow\ImageShow\ImageShowView.cpp(75) : error C2664: “Gdiplus::Image::Image(const WCHAR *,BOOL)” : 不能将参数 1 从“wchar_t”转换为“const WCHAR *”
Point destPoints[3] = { Point(0, 0), Point(image.GetWidth(), 0), Point(0, image.GetHeight()) }; 编译时出现如下错误:请问高手怎么解决?(在线等 3Q!):\Project\ImageShow\ImageShow\ImageShowView.cpp(75) : error C2664: “Gdiplus::Image::Image(const WCHAR *,BOOL)” : 不能将参数 1 从“wchar_t”转换为“const WCHAR *”
这样试试.
感谢,现在编译通过了,不过没有显示图片,请问原因何在?
这是我的:
void CImageShowView::OnDraw(CDC* pDC)
{
CImageShowDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return; // TODO: 在此处为本机数据添加绘制代码
this->GetParent()->SetWindowText(strOpenFileName); //建立图像对象 Graphics graphics(pDC->m_hDC); //装入图形文件
Image image((WCHAR *)(strOpenFileName.GetBuffer(strOpenFileName.GetLength())));
Point destPoints[3] = { Point(0, 0), Point(image.GetWidth(), 0), Point(0, image.GetHeight()) }; Point* pdestPoints = destPoints; //在指定区域pdestPoints显示图像 graphics.DrawImage(&image, pdestPoints, 3); } 这是我的
void CImageShowView::OnFileOpen()
{
// TODO: 在此添加命令处理程序代码
static char szFilter[]="常见格式图像文件(*.*)|*.*|"; CFileDialog dlgChoseImage(1,NULL,NULL,NULL,szFilter);
if (IDOK==dlgChoseImage.DoModal()) {
strOpenFileName=dlgChoseImage.GetPathName();
this->Invalidate();
}
}