// MyFormView.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "MyFormView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CBrush g_editbkbrush; #ifdef NEW_SKIN ///////////////////////////////////////////////////////////////////////////// // MyFormView IMPLEMENT_DYNCREATE(MyFormView, CFormView) MyFormView::MyFormView() : CFormView(MyFormView::m_id) { //{{AFX_DATA_INIT(MyFormView) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } MyFormView::MyFormView(UINT id): CFormView(id) { m_id=id; } MyFormView::~MyFormView() { } void MyFormView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(MyFormView) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(MyFormView, CFormView) //{{AFX_MSG_MAP(MyFormView) // NOTE - the ClassWizard will add and remove mapping macros here. ON_WM_CTLCOLOR() ON_WM_ERASEBKGND() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MyFormView diagnostics #ifdef _DEBUG void MyFormView::AssertValid() const { CFormView::AssertValid(); } void MyFormView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // MyFormView message handlers BOOL MyFormView::OnEraseBkgnd(CDC* pDC) { // TODO: Add your message handler code here and/or call default #ifdef NEW_SKIN if(g_pMainWnd2->m_pBk) { // Graphics graph(pDC->GetSafeHdc ()); CRect rc; GetClientRect (rc); pDC->FillSolidRect (rc, g_bkcol); return 1; } return CFormView::OnEraseBkgnd(pDC); #else return CFormView::OnEraseBkgnd(pDC); #endif } HBRUSH MyFormView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if(nCtlColor==CTLCOLOR_STATIC) { char szTemp[MAX_PATH]; GetClassName(pWnd->GetSafeHwnd (), szTemp, sizeof(szTemp)); if(lstrcmpi(szTemp, "Edit") == 0) { pDC->SetBkColor( g_bkcol ); return g_editbkbrush; } else { pDC->SetBkColor( g_bkcol ); pDC->SetBkMode (TRANSPARENT); } return g_editbkbrush; } else if(nCtlColor==CTLCOLOR_BTN) { pDC->SetBkColor( g_bkcol ); pDC->SetBkMode (TRANSPARENT); return g_editbkbrush; } // TODO: Return a different brush if the default is not desired return hbr; } void MyFormView::SetDlgItemText(int id, CString str) { CFormView::SetDlgItemText( id, str); CRect rc; GetDlgItem(id)->GetWindowRect(rc); ScreenToClient(rc); InvalidateRect(rc); } #endif