Solved

CtabCtrl Better look...

Posted on 2003-11-25
6
585 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
[X]
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
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
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!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
WinWaitActive parameters 12 31
twoTwo  challenge 35 118
Change to event 1 135
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seveā€¦
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

739 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