CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #3
    Join Date
    Apr 2005
    Posts
    14

    Re: Transparent checkbox on Property Page?

    I'm hoping a picture is worth a thousand words:

    I didn't know how to get my bitmap to show here, so I attached it (help me with that one too? ) :-)

    Here is how I'm attempting to handle the messages to the screen

    HBRUSH CWanSetup::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);

    // Change any attributes of the DC here
    CBrush m_HollowBrush;
    // Return a different brush if the default is not desired
    // let static controls shine through
    switch(nCtlColor) {
    case CTLCOLOR_STATIC :
    case CTLCOLOR_BTN:
    case CTLCOLOR_MSGBOX:
    pDC->SetBkMode(TRANSPARENT);
    VERIFY(m_HollowBrush.CreateStockObject(HOLLOW_BRUSH));
    return HBRUSH(m_HollowBrush);
    default:
    break;
    }


    return hbr;
    }


    void CWanSetup::OnPaint()
    {
    CPaintDC dc(this); // device context for painting
    // Do not call CPropertyPage::OnPaint() for painting messages
    CBitmap BkBmp, *pOldBmp;
    BkBmp.LoadBitmap(IDB_BACKGROUND);
    CDC BmpDc;
    VERIFY( BmpDc.CreateCompatibleDC(&dc));
    pOldBmp = (CBitmap *)BmpDc.SelectObject(&BkBmp);
    //dc.BitBlt(0,0,m_nW, m_nH, &BmpDc, 0, 0, SRCCOPY);
    dc.BitBlt(0,0,1500, 1500, &BmpDc, 0, 0, SRCCOPY);
    BmpDc.SelectObject(pOldBmp);

    }

    BOOL CWanSetup::OnEraseBkgnd(CDC* pDC)
    {
    if(m_bmpBackground.GetPixelPtr() != 0)
    {
    CRect rc;
    GetClientRect(rc);
    int x = 0, y = 0;
    m_bmpBackground.DrawDIB(pDC, 0, 0, rc.Width(), rc.Height());
    return TRUE;
    }
    else
    return CPropertyPage::OnEraseBkgnd(pDC);
    }

    void CWanSetup::OnPaletteChanged(CWnd* pFocusWnd)
    {
    CMonroeDlg* psheet = (CMonroeDlg*) GetParent();
    psheet->OnPaletteChanged(pFocusWnd);
    CPropertyPage::OnPaletteChanged(pFocusWnd);
    }

    BOOL CWanSetup::OnQueryNewPalette()
    {
    CMonroeDlg* psheet = (CMonroeDlg*) GetParent();
    psheet->OnQueryNewPalette();
    return CPropertyPage::OnQueryNewPalette();}
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured