15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Bitmap on a Wizard

Dan Edwards -- dedwards@silvercrk.com
Monday, February 03, 1997

Environment: MSVC 4.0/Win95

I've got a CPropertySheet that has been wizard moded. How do I get a bitmap
on the left side of it? The only solution I've thought of is to just move
all the controls over to the right then blit it in. That seems kind of
lame, I also used to have an example that did it a differently, can't find
it now though.

Thanks
Dan



David Lowndes -- David.Lowndes@bj.co.uk
Wednesday, February 05, 1997

[Mini-digest: 5 responses]

>I've got a CPropertySheet that has been wizard moded. How do I get a bitmap
on the left side of it? The only solution I've thought of is to just
move
all the controls over to the right then blit it in. That seems kind of
lame, I also used to have an example that did it a differently, can't
find
it now though.
<

Dan,

As you say, you'll need to re-arrange your dialog to make room, then add
a
picture control to the dialog, set its property to type "bitmap", and
select
the Image ID of a bitmap in your resource file.

If you're doing a lot of work with Wizards, have a look at the Ultra
Wizard
product, It's a Visual C++ add-in component. It makes light work of
creating
fully fledged wizard dialogs (including the bitmaps), and you've got all
the
MFC source code generated in your project so that you can easily enhance
your wizards should you need to.

>Dave
-----From: "Rob Warner" 

I just put bitmaps on my property pages using the resource editor.  HTH.

Rob Warner
rhwarner@southeast.net
http://users.southeast.net/~rhwarner


----------
> From: Dan Edwards 
> To: mfc-l@netcom.com
> Subject: Bitmap on a Wizard
> Date: Monday, February 03, 1997 7:00 PM
> 
> Environment: MSVC 4.0/Win95
> 
> I've got a CPropertySheet that has been wizard moded. How do I get a
bitmap
> on the left side of it? The only solution I've thought of is to just move
> all the controls over to the right then blit it in. That seems kind of
> lame, I also used to have an example that did it a differently, can't
find
> it now though.
> 
> Thanks
> Dan
-----From: "Vincent A. Busam" 

We have put a bitmap on all pages in a wizard sheet.  In the dialog editor
we put a stataic control of the right size and in the desired position on
each page that was to have the bitmap, and all with the same id.  We derived
a class from CPropertyPage that painted the bitmap into the control and used
this class as the base class for all of our property pages.  Hope this code
helps.

BOOL cSetupBasePage::OnInitDialog() 
{
    CPropertyPage::OnInitDialog();
    if ( m_uBitmap != 0 )           // m_uBitmap passed to constructor
    {   // must have a dialog item for bitmap on this page
        CWnd* pStatic = GetDlgItem ( IDC_SETUP_BITMAP );
        ASSERT ( pStatic != NULL );
        // get position of static in property page
        pStatic -> GetWindowRect ( &m_StaticRect );
        ScreenToClient ( &m_StaticRect );	// save where to draw bitmap
        // hide static for bitmap
        pStatic -> ShowWindow ( SW_HIDE );
    }
    return TRUE;  // return TRUE unless you set the focus to a control
                    // EXCEPTION: OCX Property Pages should return FALSE
}

void cSetupBasePage::OnPaint() 
{
    CPaintDC dc(this); // device context for painting
    if ( m_uBitmap != 0 )
    {
        HBITMAP bmp = ::LoadBitmap(AfxGetInstanceHandle(), 
                                    MAKEINTRESOURCE(m_uBitmap));
        BITMAP  bm;
        if ( bmp != NULL &&
                    ::GetObject( bmp, sizeof(BITMAP), &bm ) ==
int(sizeof(BITMAP)) )
        {
            HDC     mdc = ::CreateCompatibleDC( dc );
            HBITMAP old = (HBITMAP)::SelectObject( mdc, bmp );
            ::BitBlt ( dc, m_StaticRect.left, m_StaticRect.top, 
                            bm.bmWidth, bm.bmHeight, mdc, 0, 0, SRCCOPY );
            ::SelectObject ( mdc, old );	// put back old bitmap
            ::DeleteDC ( mdc );
            ::DeleteObject ( bmp );		// delete bitmap we created
        }
        else
            ASSERT ( FALSE );				// problem - should not occur
    }
    // Do not call CPropertyPage::OnPaint() for painting messages
}

At 04:00 PM 2/3/97 -0800, you wrote:
>Environment: MSVC 4.0/Win95
>
>I've got a CPropertySheet that has been wizard moded. How do I get a bitmap
>on the left side of it? 

-----From: "Dana M. Epp" 

Usually your CPropertyPages for the CPropertySheet are from resource
dialogs. All you have to do is insert an image in there, and your done. 

At 04:00 PM 2/3/97 -0800, you wrote:
>Environment: MSVC 4.0/Win95
>
>I've got a CPropertySheet that has been wizard moded. How do I get a bitmap
>on the left side of it? The only solution I've thought of is to just move
>all the controls over to the right then blit it in. That seems kind of
>lame, I also used to have an example that did it a differently, can't find
>it now though.
>
>Thanks
>Dan
>
PC'ing you,                     
Dana M. Epp          
eppdm@uniserve.com
http://bedrock.cyberhq.com/dana

     "How can one work with the technology of today, using yesterdays
      software and methods, and still be on the leading edge tomorrow?
      Why settle for less... I won't! "

-----From: "P.J.  Tezza" 

The simplest solution we found to this problem was to place a static 
control where you want the bitmap to show up. We then derive a class from 
CStatic and subclass it on each of our property pages. The CStatic derived 
class then paints the bitmap correctly for various resolutions and color 
depths. I played around with a couple of other solutions such as moving the 
controls to the right at runtime and painting on the property sheet instead 
of the property page. In the end, I decided that the other solutions were 
too hard to maintain and stuck with the CStatic solution.

PJ
pj@exemplarsoftware.com

-----Original Message-----
From:	Dan Edwards [SMTP:dedwards@silvercrk.com]
Sent:	Monday, February 03, 1997 7:00 PM
To:	mfc-l@netcom.com
Subject:	Bitmap on a Wizard

Environment: MSVC 4.0/Win95

I've got a CPropertySheet that has been wizard moded. How do I get a bitmap
on the left side of it? The only solution I've thought of is to just move
all the controls over to the right then blit it in. That seems kind of
lame, I also used to have an example that did it a differently, can't find
it now though.

Thanks
Dan




| Вернуться в корень Архива |