scully12
asked on
Property Sheet with an image displayed on the left side.
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 (https://www.experts-exchange.com/questions/10072471/Eliminating-Flicker-in-a-Property-Sheet.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::OnInitDial og();
CRect rectWnd;
GetWindowRect(rectWnd);
SetWindowPos(NULL, 0, 0,
rectWnd.Width() + 150,
rectWnd.Height(),
SWP_NOZORDER | SWP_NOACTIVATE);
m_picture.CreateEx( WS_EX_CLIENTEDGE, _T("STATIC"), _T("#135"),
SS_BITMAP | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
rectWnd.Width(), 20, 80, 24, m_hWnd, 0, 0 );
CenterWindow();
return bResult;
}
I can upload the code that I have so far to a server if that would help somebody help me.
BOOL CPropSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDial
CRect rectWnd;
GetWindowRect(rectWnd);
SetWindowPos(NULL, 0, 0,
rectWnd.Width() + 150,
rectWnd.Height(),
SWP_NOZORDER | SWP_NOACTIVATE);
m_picture.CreateEx( WS_EX_CLIENTEDGE, _T("STATIC"), _T("#135"),
SS_BITMAP | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
rectWnd.Width(), 20, 80, 24, m_hWnd, 0, 0 );
CenterWindow();
return bResult;
}
I can upload the code that I have so far to a server if that would help somebody help me.
ASKER
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 )
continue;
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?
BOOL CPropSheet::OffsetButtons(
{
CTabCtrl* pTabControl = pSheet->GetTabControl( );
for( CWnd* pChild = pSheet->GetWindow( GW_CHILD ); pChild; pChild = pChild->GetNextWindow( GW_HWNDNEXT ))
{
if( pChild == pTabControl || pChild == this )
continue;
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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,
-scully12
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,
-scully12
void CMyProperyPage::MoveTabs()
{
CRect rectWnd;
CWnd* pTab = GetTabControl();
pTab->GetWindowRect(rectWn
pTab->MoveWindow(SHIFT_RIG
CWnd* pPage = GetActivePage();
pPage->GetWindowRect(rectW
pPage->MoveWindow(SHIFT_RI
}
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.