mfc_dlg_image - 8BitsCoding/RobotMentor GitHub Wiki
์ ํ์ ํตํด ์ด๋ฏธ์ง ์ ํ ๋ค์ด์ผ๋ก๊ทธ๋ก ์ด๋ฏธ์ง๋ฅผ ์ ํํ๋ฉด ์ ํ๋ ์ด๋ฏธ์ง๊ฐ ๋ค์ด์ผ๋ก๊ทธ์ ์ ์๋จ.
void CMFCApplication6Dlg::OnPaint()
{
CPaintDC dc(this); // ๊ทธ๋ฆฌ๊ธฐ๋ฅผ ์ํ ๋๋ฐ์ด์ค ์ปจํ
์คํธ์
๋๋ค.
if (IsIconic())
{
// ...
}
else
{
if (image.IsNull() != 0) {
dc.SetStretchBltMode(COLORONCOLOR);
image.Draw(dc, m_rect);
}
// CDialogEx::OnPaint();
}
}
void CMFCApplication6Dlg::OnBnClickedSlectBtn()
{
wchar_t name_filter[] = L"๋ชจ๋ ํ์ผ(*.*)|*.*|Jpeg ํ์ผ(*.jpg)|*.jpg|PNG ํ์ผ(*.png)|*.png||";
CFileDialog ins_dlg(TRUE, L"jpg", L"*.jpg", OFN_HIDEREADONLY | OFN_NOCHANGEDIR, name_filter);
ins_dlg.m_ofn.nFilterIndex = 2;
if (IDOK == ins_dlg.DoModal()) {
GetClientRect(m_rect);
if (!image.IsNull()) {
image.Destroy();
}
image.Load(ins_dlg.GetPathName());
Invalidate(FALSE);
}
}
void CMFCApplication6Dlg::OnSize(UINT nType, int cx, int cy)
{
CDialogEx::OnSize(nType, cx, cy);
//GetClientRect(m_rect);
m_rect.right = cx;
m_rect.bottom = cy;
Invalidate(FALSE);
}