반응형 C & C++444 Static Control 의 배경을 투명하게 만들기 체크박스를 투명하게 하기 위해서는 OnCtrlColor 을 재정의해서 사용하면 된다. HBRUSH CTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: 여기서 DC의 특성을 변경합니다. int nRet = pWnd->GetDlgCtrlID(); if (nRet == IDC_CHECK_TIME_LIMIT) { pDC->SetBkMode(TRANSPARENT); hbr = (HBRUSH)GetStockObject(NULL_BRUSH); } // TODO: 기본값이 적당하지 않으면 다른 브러시를 반환합니다. return hbr; } 하지만 이렇게.. 2011. 10. 25. Static 에 텍스트를 쓸때 겹쳐서 나올 경우 if(pWnd->GetDlgCtrlID() == IDC_STATIC_DOWNLOAD) { pDC->SetBkColor(RGB(255,255,255)); pDC->SetBkMode(TRANSPARENT); hbr = (HBRUSH)GetStockObject(NULL_BRUSH); }위와 같이 처리해 주면, Static Control 에 배경을 투명하게 만들어 줄 수 있다. 하지만, 연속적으로 Static 에 값을 쓰게 되면 아래와같이 그림이 겹치게 되는데. pDC->SetBkMode(TRANSPARENT); // 이것을 pDC->SetBkMode(OPAQUE); // 바꿔준다 이렇게 처리해주면, 아래와 같이 겹치지 않게 된다. 2011. 10. 25. 파일 다이얼로그에서 단일 * 다중선택 CString saveFileName = L"";CString strFileName = L"";CString strExtention = L"";int nExtentionIndex = -1;CFileDialog fSaveAsFile(FALSE, _T(""), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_PATHMUSTEXIST, _T("BMP|*.bmp|PNG|*.png|JPG|*.jpg||") );if (fSaveAsFile.DoModal() != IDOK ){return;}else{strFileName = fSaveAsFile.GetPathName();strExtention = fSaveAsFile.GetFileExt(); if(s.. 2011. 10. 25. 여러 페이지 인쇄하기 // 인쇄 다이얼로그 박스 출력 CPrintDialog printDlg(FALSE); if (printDlg.DoModal() == IDCANCEL) return; // 프린터 DC를 얻음 CDC dc; dc.Attach(printDlg.GetPrinterDC()); dc.m_bPrinting = TRUE; // 인쇄될 도큐먼트에 관한 정보 설정 CString strTitle; strTitle.LoadString(AFX_IDS_APP_TITLE); DOCINFO di; ::ZeroMemory (&di, sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); di.lpszDocName = strTitle; // 도큐먼트 인쇄 시작 BOOL bPrintingOK = dc.St.. 2011. 10. 25. 마우스 드레그 하여 다이얼 로그 이동 //header afx_msg void OnLButtonDown(UINT nFlags, CPoint point); //cpp BEGIN_MESSAGE_MAP(CTest, CDialog) ON_WM_LBUTTONDOWN() END_MESSAGE_MAP() void CTest::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다. SendMessage(WM_NCLBUTTONDOWN, HTCAPTION, 0); CDialog::OnLButtonDown(nFlags, point); } 2011. 10. 25. 다이얼로그에 배경입히기 Adding the class to your project There are three steps you have to follow before you can use this class in your project. Add BDialog.cpp and BDialog.h to your project Replace all instances of CDialog with CBDialog. Do this to both the cpp and h file of your dialog class. For example if your project is called Test, make the changes to TestDlg.cpp and TestDlg.h. You'll have to use Find and Replace.. 2011. 10. 19. 이전 1 ··· 28 29 30 31 32 33 34 ··· 74 다음 반응형