Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to paint CExtWA < CExtWS < CExtAFV < CFormView > > >? Collapse All
Subject Author Date
delu qiu May 16, 2007 - 8:58 AM

Hi,

The view window can display background picture with Prof-UIS 2.61, but can not display background picture with Prof-UIS 2.64.
I applied Aqua skin to the view window.

class CMainView
    :public CExtWA < CExtWS < CExtAFV < CFormView > > >
//class CMainView : public CFormView
{
protected:
    CMainView(); // protected constructor used by dynamic creation
    DECLARE_DYNCREATE(CMainView)

// Form Data
public:
    int DEF_VSPACE,DEF_HSPACE,DEF_BUTTON_HEIGHT,DEF_LOGO_HEIGHT,DEF_DLG_WIDTH,DEF_DLG_HEIGHT;
    int DEF_TABWIDTH;
    //{{AFX_DATA(CMainView)
    enum { IDD = IDD_FORMVIEW };
    CExtButton    m_btnISZ4;
    CExtButton    m_btnISZ3;
    CExtButton    m_btnISZ2;
    CExtButton    m_btnISZ1;
    CExtButton    m_btnAUDI4;
    CExtButton    m_btnAUDI3;
    CExtButton    m_btnAUDI2;
    CExtButton    m_btnAUDI1;
    CExtButton    m_btnVW4;
    CExtButton    m_btnVW3;
    CExtButton    m_btnVW2;
    CExtButton    m_btnVW1;
    CExtButton    m_btnMZD4;
    CExtButton    m_btnMZD3;
    CExtButton    m_btnMZD2;
    CExtButton    m_btnMZD1;
    CExtButton    m_btnSATU6;
    CExtButton    m_btnSATU5;
    CExtButton    m_btnSATU4;
    CExtButton    m_btnSATU3;
    CExtButton    m_btnSATU2;
    CExtButton    m_btnSATU1;
    CExtButton    m_btnTOY5;
    CExtButton    m_btnTOY4;
    CExtButton    m_btnTOY3;
    CExtButton    m_btnTOY2;
    CExtButton    m_btnTOY1;
    CExtButton    m_btnHOD4;
    CExtButton    m_btnHOD3;
    CExtButton    m_btnHOD2;
    CExtButton    m_btnHOD1;
    CExtButton    m_btnGen3;
    CExtButton    m_btnGen2;
    CExtButton    m_btnGen1;
    CExtButton    m_btn2534GP7;
    CExtButton    m_btn2534GP6;
    CExtButton    m_btn2534GP5;
    CExtButton    m_btn2534GP4;
    CExtButton    m_btn2534GP3;
    CExtButton    m_btn2534GP2;
    CExtButton    m_btn2534GP1;
    CExtButton    m_btnChry7;
    CExtButton    m_btnChry6;
    CExtButton    m_btnChry5;
    CExtButton    m_btnChry4;
    CExtButton    m_btnChry3;
    CExtButton    m_btnChry2;
    CExtButton    m_btnChry1;
    CExtButton    m_btnFord6;
    CExtButton    m_btnFord5;
    CExtButton    m_btnFord4;
    CExtButton    m_btnFord3;
    CExtButton    m_btnFord2;
    CExtButton    m_btnFord1;
    CExtButton    m_btnGM6;
    CExtButton    m_btnGM5;
    CExtButton    m_btnGM4;
    CExtButton    m_btnGM3;
    CExtButton    m_btnGM2;
    CExtButton    m_btnGM1;
    CLeftTab    m_tab;
    //}}AFX_DATA

// Attributes
public:
    CString strPopupFile1;
    CString strPopupFile2;
    CString strPopupFile3;
    CString    m_GMWEB_Path;
    CString strHlpfile;
    CString hlpcmd;
    CString strInstallPath;
    CString strExeVUW;
    CString strDirVUW;
    CString strExeCUW;
    CString strDirCUW;
    CString strExeFMP;
    CString strDirFMP;
    PROCESS_INFORMATION prInfo;
    STARTUPINFO stInfo;

    PROCESS_INFORMATION prInfo1;
    STARTUPINFO stInfo1;
    

// Operations
public:
    void ShowHH(CString page);
    void HideButtons();
    BOOL ShowTaskManager(int menu_index);
    BOOL GetInstallFolder();
    BOOL GetHlpDir();
    BOOL RunProcess(CString sCmdLine,CString sCurDir);
    COLORREF colorBK;

// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMainView)
    public:
    virtual void OnInitialUpdate();
    protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
    //}}AFX_VIRTUAL

// Implementation
protected:
    int nCurTab;
    void SetPosbyRowCol(CWnd * pWnd,int nRows, int nCols, int iRow, int iCol);
    BOOL SetItemPos();
    BOOL ShowTab();
    void SetUI();
    virtual ~CMainView();
#ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
#endif

    // Generated message map functions
    //{{AFX_MSG(CMainView)
    afx_msg void OnPaint();
    afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult);
    afx_msg void OnTimer(UINT nIDEvent);
    afx_msg void OnBtnGm1();
    afx_msg void OnBtnGm2();
    afx_msg void OnBtnGm3();
    afx_msg void OnBtnGm4();
    afx_msg void OnBtnGm5();
    afx_msg void OnBtnGm6();
    afx_msg void OnBtnFord1();
    afx_msg void OnBtnFord2();
    afx_msg void OnBtnFord3();
    afx_msg void OnBtnFord4();
    afx_msg void OnBtnFord5();
    afx_msg void OnBtnFord6();
    afx_msg void OnBtnChrysler1();
    afx_msg void OnBtnChrysler2();
    afx_msg void OnBtnChrysler3();
    afx_msg void OnBtnChrysler4();
    afx_msg void OnBtnChrysler5();
    afx_msg void OnBtnChrysler6();
    afx_msg void OnBtnChrysler7();
    afx_msg void OnBtnGernal1();
    afx_msg void OnBtnGernal2();
    afx_msg void OnBtnGernal3();
    afx_msg void OnBtn2534gp1();
    afx_msg void OnBtn2534gp2();
    afx_msg void OnBtn2534gp3();
    afx_msg void OnBtn2534gp4();
    afx_msg void OnBtn2534gp5();
    afx_msg void OnBtn2534gp6();
    afx_msg void OnBtn2534gp7();
    afx_msg void OnBtnToy1();
    afx_msg void OnBtnToy2();
    afx_msg void OnBtnToy3();
    afx_msg void OnBtnToy4();
    afx_msg void OnBtnHod1();
    afx_msg void OnBtnHod2();
    afx_msg void OnBtnHod3();
    afx_msg void OnBtnHod4();
    afx_msg void OnBtnSatu1();
    afx_msg void OnBtnSatu2();
    afx_msg void OnBtnSatu3();
    afx_msg void OnBtnSatu4();
    afx_msg LRESULT OnShowTab(WPARAM wParam, LPARAM lParam);
    afx_msg void OnBtnMzd1();
    afx_msg void OnBtnVw1();
    afx_msg void OnBtnIsz1();
    afx_msg void OnBtnToy5();
    afx_msg void OnBtnMzd2();
    afx_msg void OnBtnMzd3();
    afx_msg void OnBtnMzd4();
    afx_msg void OnBtnVw2();
    afx_msg void OnBtnVw3();
    afx_msg void OnBtnVw4();
    afx_msg void OnBtnIsz2();
    afx_msg void OnBtnIsz3();
    afx_msg void OnBtnIsz4();
    afx_msg void OnBtnAudi1();
    afx_msg void OnBtnAudi2();
    afx_msg void OnBtnAudi3();
    afx_msg void OnBtnAudi4();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};


void CMainView::OnPaint()
{
    CPaintDC truedc(this);

    CRect rcPage1,rcClient;
    GetClientRect(&rcPage1);

    CDC dc;
    dc.CreateCompatibleDC(&truedc);

    CBitmap bitmap;
    bitmap.CreateCompatibleBitmap(&truedc,
                                 rcPage1.Width(),
                                 rcPage1.Height());
    CBitmap* pOldBitmap;
    pOldBitmap = dc.SelectObject(&bitmap);


    CRect rect;
    GetClientRect(&rect);

    CBrush brush;
    CBitmap bmp;
    if(bmp.LoadBitmap (IDB_BITMAP5))
    {
        brush.CreatePatternBrush( &bmp);
        CDC::FromHandle(dc)->FillRect(    &rect,
                                        &brush);
    }

    CDC::FromHandle(truedc)->BitBlt(0,
                            0,
                            GetSystemMetrics (SM_CXSCREEN),
                            GetSystemMetrics (SM_CYSCREEN),
                            &dc,
                            0,
                            0,
                            SRCCOPY);
}

Technical Support May 16, 2007 - 10:22 AM


Please remove the OnPaint() handler method and add the WindowProc() virtual method:

LRESULT CMainView::WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
      switch( message )
      {
      case WM_PAINT:
            CPaintDC dcPaint( this );
            CRect rcClient;
            GetClientRect( &rcClient );
            CExtMemoryDC dc( &dcPaint, &rcClient );
//
// FIRST STEP: Draw Prof-UIS themed background here
//
            COLORREF clrBackground = GetBkColor();
            bool bTransparent = false;
            if(         PmBridge_GetPM()->GetCb2DbTransparentMode(this)
                  &&    ( clrBackground == COLORREF(-1L) )
                  )
            {
                  CExtPaintManager::stat_ExcludeChildAreas(
                        dc,
                        GetSafeHwnd(),
                        CExtPaintManager::stat_DefExcludeChildAreaCallback
                        );
                  if( PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this ) )
                        bTransparent = true;
            }
            if(         (! bTransparent)
                  &&    clrBackground != COLORREF(-1L)
                  )
                  dc.FillSolidRect(
                        &rcClient,
                        clrBackground
                        );    
            PmBridge_GetPM()->OnPaintSessionComplete( this );

//
// SECOND STEP: Draw your custom things into dc here
//

            return 0L;
      }
      return CExtWA < CExtWS < CExtAFV < CFormView > > > :: WindowProc( message, wParam, lParam );
}