• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 449
  • Last Modified:

How to add a bitmap at the top of a property sheet?

Hello all,

  I want to add a bitmap at the top of a property sheet. Since I can't drag and drop the bitmap on the property sheet like normal dialog, I probably have to manually create the control and put it on the property sheet. How should I resize the property sheet and make sure that the bitmap is at the top of all property pages? Thanks.
0
qwang73
Asked:
qwang73
  • 5
  • 4
  • 2
  • +2
1 Solution
 
GloriousRainCommented:
Search in MSDN "Wizard97", you can find "WIZARD97: Demonstrates CPropertyPageEx and CPropertySheetEx
" sample for your problem or link http://msdn.microsoft.com/library/devprods/vs6/visualc/vcsample/vcsmpwizard97.htm
0
 
DanRollinsCommented:
You could derive all of your pages from a CPropertyPage-derived base class, then have its OnInitDialog() fn create the bitmap image at a certain location.  But that is a headache and you end up losing some flexibility with the ClassWizard.

Another alternative is to derive from CPropertySheet and have each of the CPropertyPage-derived object call into it with a fun such as

  void CMySheet::DrawThatSpecialPictureAtThatSpecialPlace( void );

However ...(roll of drums)... by FAR the easiest technique is to just put the bitmap in a dialog control on each page.  Create a STATIC control (it looks like a picture of cactus in the control palette of the dialog editor) and set the to show the desired bitmap.

If that does not answer your question, then please describe the situation in more detail.

-- Dan
0
 
mirecCommented:
Try:
http://www.codeguru.com/propertysheet/tab_image.shtml

Hope this is what you want.
m.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
qwang73Author Commented:
Hello All,

  Thanks a lot for your help. Dan, unfortunately I can't put the bitmap in each property page because that won't look nice. Mirec, I need to put the bitmap on the property sheet above all the property pages.

  What I tried first is changing the size of property sheet. However, the extract space went to the bottom of the property sheet instead of to the top. Here's my code:

BOOL CMainPropSheet::OnInitDialog()
{
   BOOL bResult = CPropertySheet::OnInitDialog();
     
   // TODO: Add your specialized code here
   // Add banner to the property sheet
   CRect Rect;
   GetWindowRect(&Rect);
   Rect.top -= 50;
   Rect.bottom += 50;
   MoveWindow(Rect.left, Rect.top, Rect.Width(),
       Rect.Height());
   ...
}

  The first question: How can I allocate the extra space at the top? The next question: How can I manually create the bitmap and put on the property sheet?

  Regards.

Nancy

0
 
mirecCommented:
Here is what you probably need:
http://www.codeguru.com/propertysheet/add_bitmap.shtml
You can place bitmap anywhere you want just by changing coordinates of x, y in
dc.BitBlt(left, rect.bottom - lower, w, h, &memdc, 0, 0, SRCCOPY);
line...
m.
0
 
DanRollinsCommented:
>>How can I allocate the extra space at the top?

CPropertySheet moves everything around in order to adjust its size to work with the variously-sized pages.

In your code, you are Using MoveWindow on the PropertySheet itself.  What you need to do is move the Tab Control.  Steps:

1) Increase the height of the CPropertySheet window

2) Use GetTabControl() to get a pointer to the main area of the sheet (where all of the pages go).  Move that window down by 50 pixels

3) Locate each of the buttons and move them down by the same amount.  Buttons can be located by their Id (IDOK, IDCANCEL, IDHELP).

-- Dan
0
 
qwang73Author Commented:
Thanks, Mirec.

The code tells me how to manually add a bitmap at the bottom of property sheet. But that only solves half of my problem. I still need to expand the property sheet, so my bitmap can be put at the top of property sheet. I also found some example in MDSN (bindenrl), which adds a control at the bottom instead of top. Is adding a control at the top difficult to implement, so everyone choose to do it at the bottom?

Regards.

Nancy

 
0
 
DanRollinsCommented:
>>I still need to expand the property sheet, so my bitmap can be put at the top

Read my post.  You need to enlarge the propertysheet window anf then move the Tab Control downward.

>>Is adding a control at the top difficult to implement, so everyone choose to do it at the bottom?

After you have implemented this, you'll notice that it looks odd -- people expect the tabs to be right at the top.  That is part of the reason.

There is extra work -- you'll need to move each of the buttons, but it's not *that* big of a deal.

-- Dan
0
 
qwang73Author Commented:
Dan,

  It must took me quite some while to write my comment since I didn't read your earlier post.

  I did try your suggestion. It worked somewhat. First, I moved the tab control, but everything inside each tab wasn't moved with the tab. Here's my code:
     CTabCtrl* pTab = GetTabControl();
     pTab->GetWindowRect(&Rect);
     pTab->MoveWindow(Rect.left-172, Rect.top+68,
          Rect.Width(), Rect.Height());
How do I move everything within the tab?

  Second, I moved all the buttons except the Apply button. I couldn't find its ID. Is it IDAPPLY?

  I know it may not be the standard look. But I have to put the banner at the top of property sheet. Hope it's not too much work.
0
 
DanRollinsCommented:
I admit that I did not actually try moving the Tab control to verify that it would work.  It could well be that each of the pages has already had it location set, thus the oddness.  When you click another tab, is its page shown correctly?  If not, things could get a bit stiky.  You will need to reposition each of the cPropertyPages.

Also, where did you put that code?  It might work better if you could do it earlier -- before all the internal calculations and button shuffling takes place.

-- Dan
0
 
WynApseCommented:
Can you put it at the bottom .... I've done that, and it looks nice over on the left side..... only have to do it once, don't have to move a lot of stuff... just some sizing...

-Dave
0
 
qwang73Author Commented:
Hello everyone,

  Thanks for all your help. Guess I have to put the bitmap at the left bottom corner, since that's what everyone is doing.

Nancy
0
 
qwang73Author Commented:
I solved my problem by using the property sheet inside a dialog box. Instead of putting the bitmap on the property sheet, I put the bitmap on the dialog box. A lot easier.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 5
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now