비트맵을 배경으로 뿌리고 그 위에 컨트롤 올리는 방법 | |||
| |||
원래 VC++ 프로그램 짜듯 짜되, 배경이미지를 하나 로딩해서 매번 Paint 해주면 된다. 다음과 같이 클레스 선언부에 m_BG라는 비트맵을 선언 HBITMAP m_BG 초기화 부분에서 비트맵 로드한다음 BOOL CCALLIDDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CenterWindow(GetDesktopWindow()); // center to the hpc screen // TODO: Add extra initialization here m_BG = (HBITMAP)LoadImage( AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDB_BG), IMAGE_BITMAP, 0, 0, 0); return TRUE; // return TRUE unless you set the focus to a control } OnPaint에서 다음과 같이 걍 뿌려준다 void CCALLIDDlg::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here RECT rc; GetClientRect( &rc); HDC hdcMem = CreateCompatibleDC(NULL); HBITMAP h = (HBITMAP)SelectObject(hdcMem, m_BG); BitBlt( dc.GetSafeHdc(), 0, 0, rc.right-rc.left, rc.bottom-rc.top, hdcMem, 0, 0, SRCCOPY ); SelectObject( hdcMem, h); // Do not call CDialog::OnPaint() for painting messages } Tags: MFC 윈도우즈 | |||
| |||
| |||
로그인을 하시면 댓글을 등록 할 수 있습니다. |
SIMILAR POSTS WinCE에서 Key Hooking하는 방법 |