Solved

CtabCtrl Better look...

Posted on 2003-11-25
6
584 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
notReplace  challenge 53 142
abstract class with all non abstract mentods 6 80
MaxSpan challenge 9 106
Capture logon name 13 88
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.

828 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