0
이 코드는 컨트롤이 int로 이동할 때 충돌하는 이미지의 종횡비를 유지하는 코드입니다. WindowRatio = WidthOfPreviewPane/HeightOfPreviewPane; 누구나 아이디어를 줄 수 있습니까 ??프로그램이 충돌하는 이미지의 종횡비
int WidthOfPreviewPane = RECTWIDTH(m_rcParent);
int HeightOfPreviewPane = RECTHEIGHT(m_rcParent) ;
int ImageRatio = WidthOfImage/HeightOfImage;
int WindowRatio = WidthOfPreviewPane/HeightOfPreviewPane;
if (WindowRatio > ImageRatio && WidthOfPreviewPane< WidthOfImage)
{
m_iFinalHeight = HeightOfPreviewPane;
m_iFinalWidth = m_iFinalHeight * ImageRatio;
MessageBox(NULL, L"1",L"Error",
MB_ICONERROR | MB_OK);
}
else if (WindowRatio < ImageRatio && WidthOfPreviewPane< WidthOfImage)
{
m_iFinalWidth = WidthOfPreviewPane;
m_iFinalHeight = m_iFinalWidth/ImageRatio;
MessageBox(NULL, L"2",L"Error",
MB_ICONERROR | MB_OK);
}
else if(WindowRatio > ImageRatio && WidthOfPreviewPane> WidthOfImage)
{
m_iFinalHeight = HeightOfImage;
m_iFinalWidth = WidthOfImage;
MessageBox(NULL, L"3",L"Error",
MB_ICONERROR | MB_OK);
}
else if(WindowRatio < ImageRatio && WidthOfPreviewPane> WidthOfImage)
{
m_iFinalHeight = HeightOfImage;
m_iFinalWidth = WidthOfImage;
MessageBox(NULL, L"4",L"Error",
MB_ICONERROR | MB_OK);
}
가정? 디버거에서 코드를 실행하려고 시도 했습니까? 창문 (m_rcParent)이 보이는지 확인합니다. 그렇지 않으면 크기가 0이므로 devisionbyzero가 발생합니다. – dmaij
'HeightOfPreviewPane'의 값이 문제 행보다 먼저 실행되는지 확인합니다. –
은'HeightOfPreviewPane'가 '0'입니까? 확인해 봐. –