2016-10-12 2 views
0

그것을 만들 버리지 않습니다 내 프로그램 (vshost.exe). 이 프로그램은 C#으로 만든 내가 게시 된 링크에 명시된 바와 같이ZedGraph는 EMF 파일이 후 나는 다음이 코드가

+0

이 이유입니다 : http://stackoverflow.com/questions/ 14869578/copyenhammafile-is-not-release-the-handle-delete-deleteenmetafile-is-cal – PaulF

+0

아마 링크를 지우지 않는 방법이 있습니다. –

답변

1

- 당신이 CopyEnhMetaFile에 의해 생성 된 핸들을 삭제해야합니다

static internal bool SaveEnhMetafileToFile(Metafile mf, string fileName) 
{ 
    bool bResult = false; 
    IntPtr hEMF; 
    hEMF = mf.GetHenhmetafile(); // invalidates mf 
    if (!hEMF.Equals(new IntPtr(0))) 
    { 
    StringBuilder tempName = new StringBuilder(fileName); 
    IntPtr hCopyEMF = CopyEnhMetaFile(hEMF, tempName.ToString()); 
    DeleteEnhMetaFile(hCopyEMF); 
    DeleteEnhMetaFile(hEMF); 
    } 
return bResult; 
} 
+0

작동합니다! 대답은 위에 있습니다! :) –