Property Sheet with an image displayed on the left side.

Posted on 2003-04-01
Medium Priority
Last Modified: 2013-11-20
I'm making an install wizard and want to put a bitmap on the left side of the property sheet. I'm using the wizard implementation of Property Sheet not the tabs. Using the code below I'm able to get the image displayed but it always shows up on the right side of the property sheet. I tried using MoveWindow to move it but it just crashes. Now, I found some code in another EE post (http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_10072471.html) that I believe is working to move the property sheet to the right. Now, how can I move my picture to the left? I'm doing it this way to avoid the flash that happens when I put the static image on each property page. Good examples please I'm kind of new to this.

BOOL CPropSheet::OnInitDialog()
     BOOL bResult = CPropertySheet::OnInitDialog();
     CRect rectWnd;
     SetWindowPos(NULL, 0, 0,
          rectWnd.Width() + 150,

     m_picture.CreateEx( WS_EX_CLIENTEDGE, _T("STATIC"), _T("#135"),
                    rectWnd.Width(), 20, 80, 24, m_hWnd, 0, 0 );


     return bResult;

I can upload the code that I have so far to a server if that would help somebody help me.
Question by:scully12
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 11

Expert Comment

ID: 8247705
Same idea as what you have here, but you need to move the property pages themselves, too.  Just add the function

void CMyProperyPage::MoveTabs()
    CRect rectWnd;

    CWnd* pTab = GetTabControl();
    pTab->MoveWindow(SHIFT_RIGHT, 0, rectWnd.Width(), rectWnd.Height(), FALSE);

    CWnd* pPage = GetActivePage();
    pPage->MoveWindow(SHIFT_RIGHT, 0, rectWnd.Width(), rectWnd.Height(), FALSE);

setting SHIFT_RIGHT to whatever you want to shift by.  Now, the MoveTabs needs to be called right after the SetWindowPos you already have in the InitDialog function above (don't forget to reposition your bitmap).

Also call this function whenever a new page is shown (WM_CHILDACTIVATE).  That should do it.


Author Comment

ID: 8247862
I think you just gave me what I already have. I used the OffsetButtons function from the other EE post like so:

BOOL CPropSheet::OffsetButtons( CPropertySheet* pSheet, CSize& sizOffset )
  CTabCtrl* pTabControl = pSheet->GetTabControl( );
  for( CWnd* pChild = pSheet->GetWindow( GW_CHILD ); pChild; pChild = pChild->GetNextWindow( GW_HWNDNEXT ))
     if( pChild == pTabControl || pChild == this )
     CRect rectWindow;
     pChild->GetWindowRect( &rectWindow );
     pSheet->ScreenToClient( &rectWindow );
     rectWindow.OffsetRect( sizOffset );
     pChild->MoveWindow( &rectWindow, TRUE );
  return TRUE;

What I'm looking for now is how can I move the static picture box that I created on my property sheet to where the property sheet used to be?
LVL 11

Accepted Solution

KurtVon earned 1200 total points
ID: 8248212
It looks like that code offsets the buttons, not the property pages.

Either way, to move your image, just change the creation parameters.  Currently you specify the left to be rectWnd.Width().  Just use RectWnd.left.

Actually, you probably want to get the left edge of the tab control and put the left edge of the tab window there:

m_picture.CreateEx( WS_EX_CLIENTEDGE, _T("STATIC"), _T("#135"),
                   rectWnd.left, rectWnd.top, BITMAP_WIDTH, min(rectWnd.Height(), BITMAP_HEIGHT), m_hWnd, 0, 0);

Author Comment

ID: 8248294
Yes, it looks like you are correct. You gave me code I didn't even know I needed yet.

I swear I messed with those creation parameters earlier and it didn't do anything. I must have had something else messed up at the time. Thanks,


Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question