Solved

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

Posted on 2001-06-21
13
425 Views
Last Modified: 2013-11-20
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
Comment
Question by:qwang73
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 2

Expert Comment

by:GloriousRain
ID: 6216643
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 6216656
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
 
LVL 2

Expert Comment

by:mirec
ID: 6218137
Try:
http://www.codeguru.com/propertysheet/tab_image.shtml

Hope this is what you want.
m.
0
 

Author Comment

by:qwang73
ID: 6219003
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
 
LVL 2

Accepted Solution

by:
mirec earned 100 total points
ID: 6219043
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 6219511
>>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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:qwang73
ID: 6219556
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 6219908
>>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
 

Author Comment

by:qwang73
ID: 6220156
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 6221097
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
 
LVL 1

Expert Comment

by:WynApse
ID: 6222228
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
 

Author Comment

by:qwang73
ID: 6267104
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
 

Author Comment

by:qwang73
ID: 6277936
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now