我無法找到該圖像^我使用CLI的rigth命名空間。它是從http://msdn.microsoft.com/en-us/library/aa970689.aspx那個網站。問題在於微軟沒有公佈我想要導入的內容,所以我甚至不知道他們的想法是什麼。什麼是正確的包括圖像CLI類
什麼包括我想補充做這項工作(圖片類)?
Error 1 error C3083: 'Controls': the symbol to the left of a '::' must be a type C:\Users\Duke\Documents\Visual Studio 2010\Projects\Jpg\Jpg\Jpg.cpp 9 1 Jpg
Error 2 error C2039: 'Image' : is not a member of 'System::Windows' C:\Users\Duke\Documents\Visual Studio 2010\Projects\Jpg\Jpg\Jpg.cpp 9 1 Jpg
Error 3 error C2871: 'Image' : a namespace with this name does not exist C:\Users\Duke\Documents\Visual Studio 2010\Projects\Jpg\Jpg\Jpg.cpp 9 1 Jpg
#include "stdafx.h"
#include "Form1.h"
#using <mscorlib.dll> //requires CLI
using namespace System;
using namespace System::IO;
using namespace System::Windows::Media::Imaging;
using namespace System::Windows::Controls::Image;
Stream^ imageStreamSource = gcnew FileStream("C:\Users\Duke\Desktop\heart.jpg", FileMode::Open, FileAccess::Read, FileShare::Read);
JpegBitmapDecoder^ decoder = gcnew JpegBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapSource^ bitmapSource = decoder->Frames[0];//< --mamy bitmape
// Draw the Image
Image^ myImage = gcnew Image();
myImage->Source = bitmapSource;
myImage->Stretch = Stretch::None;
它說沒有這樣的命名空間,請看編輯。 – Yoda
@RobertKilar A downvote for not complying you made to your question _after_ I write my answer似乎有點不合理 – Rook
@RobertKilar仍然沒有好處? – Rook