, 당신은 그것은 메모리 스트림을 반환합니다
ResourceManager.GetStream
http://msdn.microsoft.com/en-us/library/zxee5096.aspx
를 호출해야합니다. 바이트 배열 메모리 스트림을 읽고 일부 임시 위치 바이트 배열을 작성하고, 인수로서 임시 파일의 경로를 사용
Process.Start()
호출한다.
public class Class1{
public static void Main(string[] args){
FileStream stream = null;
string fullTempPath = null;
try{
byte[] page = Resources.HTMLPage1;
fullTempPath = Path.GetTempPath() + Guid.NewGuid() + ".html";
stream = new FileStream(fullTempPath, FileMode.Create, FileAccess.Write, FileShare.Read);
stream.Write(page, 0, page.Length);
stream.Flush(true);
stream.Close();
Process proc = new Process{StartInfo ={FileName = fullTempPath}};
proc.Start();
}
finally{
if (stream != null){
stream.Dispose();
}
}
}
}
를 사용하여 HTML 파일을 열려면이 코드 : 여기
은 샘플 코드? 응용 프로그램 리소스 또는 하드 드라이브의 실제 디렉터리? – Oscar무엇이 오류입니까? 그것은 런타임 또는 컴파일 시간에 있습니까? 그 괄호를 제거 했습니까? –
애플리케이션 리소스를 의미합니다. 오류는 파일을 찾을 수 없습니다. 그렇습니다. – Proton