<div style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림">다이얼로그 A에서</font></div> <div style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림">CFile 클래스로 jpg 파일을 열고, </font></div> <div style="font-family:'Malgun Gothic';font-size:medium;"><span style="font-family:'굴림';">CFile로 불러온 파일을 임의버퍼에 저장한뒤</span></div> <div style="font-family:'Malgun Gothic';font-size:medium;"><span style="font-family:'굴림';">다른 다이얼로그 B의 버퍼로 옮기고 </span><span style="font-family:'굴림';">인텔 jpg 라이브러리를 이용해서</span></div> <div style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림">B의 픽쳐컨트롤에 출력하려 하고있습니다</font></div> <div style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림"><br></font></div> <div style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림">다음은 다이얼로그 A입니다</font></div> <div style="font-family:'Malgun Gothic';font-size:medium;"> <div><font face="굴림">if(File.Open(m_sFileDir, CFile::modeRead))</font></div> <div><span style="font-family:'굴림';">{</span></div></div><span class="Apple-tab-span" style="font-size:medium;white-space:pre;"> </span><span style="font-size:medium;">fileLen = File.GetLength();</span><span class="Apple-tab-span" style="font-size:medium;white-space:pre;"> </span><br style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림" style="font-size:medium;"><br></font><span class="Apple-tab-span" style="font-size:medium;white-space:pre;"> </span><span style="font-size:medium;">BYTE * buffer = new BYTE[fileLen];</span><br style="font-family:'Malgun Gothic';font-size:medium;"><span class="Apple-tab-span" style="font-size:medium;white-space:pre;"> </span><span style="font-size:medium;">File.Read(buffer,fileLen);</span> <div style="font-family:'Malgun Gothic';font-size:medium;"><font face="굴림"><br></font><span class="Apple-tab-span" style="font-family:'굴림';white-space:pre;"> </span><span style="font-family:'굴림';">h.DrawImg(&buffer,fileLen);</span><br><font face="굴림"><br></font><span class="Apple-tab-span" style="font-family:'굴림';white-space:pre;"> </span><span style="font-family:'굴림';">File.Close();</span><br><div><font face="굴림">}</font></div> <div><font face="굴림">위와 같이 CFile로 Read한 버퍼의 주소와 길이를 다른 다이얼로그의 함수 인자로 넘겨주었고</font></div> <div><font face="굴림">받는 다이얼로그 B에서 bmif 구조체에 비트맵 정보로 저장했습니다</font></div> <div><font face="굴림">(원하는 사진이 출력 되긴 되니까 bmif 구조체에 데이터는 제대로 옮겨지는것 같습니다)</font></div> <div><font face="굴림"><br></font></div> <div><font face="굴림">문제는 다이얼로그B의 출력하는 부분인데</font></div> <div><font face="굴림">연습삼아 만들어본 대화상자 기반 프로젝트에서는 같은 코드로</font></div> <div><font face="굴림">해당 픽쳐컨트롤 시작위치에 맞게 비트맵이 출력됩니다.</font></div> <div><font face="굴림"><br></font></div> <div><font face="굴림">그러나 SDI기반에서 같은방식으로 코드를 짜면</font></div> <div><font face="굴림">픽쳐컨트롤이 아닌 윈도우(모니터)의 0,0위치에서 그림이 그려집니다.</font></div> <div><font face="굴림">DC를 제대로 못구한것같은데, 픽쳐컨트롤의 알맞은 DC를 구하려면 어떻게 해야하나요?</font></div> <div><br></div> <div><font face="굴림">다음은 다이얼로그 B의 DrawImg(BYTE* arry[], int len) 함수의 출력부분입니다.</font></div> <div><br></div> <div><font face="굴림"><br></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>hdc = ::GetDC(m_Img);</span></font></div> <div><span class="Apple-tab-span" style="white-space:pre;font-size:12px;"><font face="굴림"> </font></span></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>::SetStretchBltMode(hdc, COLORONCOLOR); // 늘이기 속성 조절. 줄여도 손상없게</span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>::StretchDIBits(hdc, 0, 0, 560, 480, 0, 0, </span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>JPEGImage.DIBWidth, JPEGImage.DIBHeight, JPEGImage.DIBBytes, </span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>(const BITMAPINFO *)&bmif, DIB_RGB_COLORS , SRCCOPY ); </span></font></div> <div><font face="굴림"><span style="font-size:12px;"><br></span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>::ReleaseDC(m_Img, hdc);</span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>// 자원 free</span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>delete []JPEGImage.DIBBytes;</span></font></div> <div><font face="굴림"><span style="font-size:12px;"><span class="Apple-tab-span" style="white-space:pre;"> </span>ijlFree(&JPEGImage);</span></font></div></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.