CtabCtrl Better look...

Posted on 2003-11-25
Medium Priority
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?
Question by:vinceTrace
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 44

Expert Comment

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).

Author Comment

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...
LVL 44

Expert Comment

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.
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.


Author Comment

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 ?

Author Comment

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...
LVL 44

Accepted Solution

AndyAinscow earned 375 total points
ID: 9817984
You get a pDC with the OnEraseBkgnd(CDC* pDC), use that for the BitBlt.
CRect 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).

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

800 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