how to use a bitmap as a dialog's background 
Author Message
 how to use a bitmap as a dialog's background

Try something like this:

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

        if ( nCtlColor == CTLCOLOR_DLG )
        {
                // m_hbr is a class member HBRUSH variable
                hbr = m_hbr;
        }

        return hbr;

Quote:
}

In OnIntDialog, create the brush from the bitmap:

                HBITMAP hBmp = LoadBitmap( AfxGetResourceHandle(),
                                MAKEINTRESOURCE( IDB_BITMAP1 ) );
                m_hbr = CreatePatternBrush( hBmp );
                DeleteObject( hBmp );

Call DeleteObject for the brush in your dialog's OnDestroy method.

Dave
--
MVP VC++ FAQ: http://www.*-*-*.com/
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Thu, 31 Jul 2003 05:44:04 GMT  
 how to use a bitmap as a dialog's background
or use the class found on www.codeguru.com

Bryce


Quote:
> Try something like this:

> HBRUSH CBitDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
> {
> HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

> if ( nCtlColor == CTLCOLOR_DLG )
> {
> // m_hbr is a class member HBRUSH variable
> hbr = m_hbr;
> }

> return hbr;
> }

> In OnIntDialog, create the brush from the bitmap:

> HBITMAP hBmp = LoadBitmap( AfxGetResourceHandle(),
> MAKEINTRESOURCE( IDB_BITMAP1 ) );
> m_hbr = CreatePatternBrush( hBmp );
> DeleteObject( hBmp );

> Call DeleteObject for the brush in your dialog's OnDestroy method.

> Dave
> --
> MVP VC++ FAQ: http://www.mvps.org/vcfaq
> My address is altered to discourage junk mail.
> Please post responses to the newsgroup thread,
> there's no need for follow-up email copies.



Sat, 01 Nov 2003 11:08:43 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using Bitmap as Background for a Dialog Box

2. Changing the Background Color of a Dialog to match the background of a Bitmap

3. Can I change the CEdit control's background to a bitmap

4. Bitmap in dialog background

5. Dialog Background Bitmap

6. display bitmap on dialog background

7. Bitmap as dialog background

8. Putting a bitmap background in a dialog

9. how to paint background of dialog with bitmap?

10. background bitmap in dialog crashing program in Release?

11. Bitmap as a background in a dialog

12. Bitmap in dialog background

 

 
Powered by phpBB® Forum Software