Solved

CtabCtrl Better look...

Posted on 2003-11-25
6
576 Views
Last Modified: 2013-11-20
Hi everybody,

In one of my dialogs, I use a CtabCtrl. (I use CTabCtrlSSL from Derek Lakin found at http://www.codeproject.com/tabctrl/ctabctrlssl.asp)
Everything works nice but I'd like to give to this TabPanel a better look, but for example by setting a bitmap as background, or a color...
CTabCtrlSSL is a subclass of CTabCtrl.
Does anyone could help me doing this?
Thanks
Vincent
 
0
Comment
Question by:vinceTrace
  • 3
  • 3
6 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 9816825
Provide a handler for the WM_ERASEBKGND message.  In the handler BitBlt your bitmap into place and return TRUE to tell the system you have performed the erase background yourself (else the default is then called).
0
 

Author Comment

by:vinceTrace
ID: 9816865
I must provide this handler to my TabPanel or to the dialog which contains the tab?
The dialog is a subclass of BkDialogST also found at codeproject.
When I right click on my dialog or my Tab and choose 'Events',  WM_ERASEBKGND  is not in the list of new events...
Thanks
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 9816891
Put it into your customised tab control.
From the wizard with the events change the selection of available events to window (child window) so the WM_ERASEBKGND appears in the list.
Try putting a breakpoint in the stub provided to check your tab control does receive the event.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:vinceTrace
ID: 9817304
I right click in my dialog and choose child window in the events wizard. I had WM_ERASEBKGND handler to my AppDlg.cpp.
In this handler I call BitBlt, but I'm not sure how to instantiate the trwo HDC needed, and I don't know how to find the x and y coordinates of my TabPanel. Are the in App.rc file ?
0
 

Author Comment

by:vinceTrace
ID: 9817487
I have found the needed coordinates, but I still don't know how to initiate the two HDC.
I 've tried       HDC hDC = ::GetWindowDC(NULL);
but I have a black rectangle instead of the portion of bitmap expected...
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 125 total points
ID: 9817984
You get a pDC with the OnEraseBkgnd(CDC* pDC), use that for the BitBlt.
CRect rect;
GetClientRect(&rect);
now you have the width and height of the tab control (assuming this is in your tab control derived class else you need a pointer to that for the GetClientRect fn).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
Change owner from userA to server Local Administrators 7 59
Best tools for Backup and restore of Wordpress site 6 55
lucky13 challenge 11 124
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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

18 Experts available now in Live!

Get 1:1 Help Now