Solved

Need to bold the tab title of the active property page

Posted on 2008-09-29
4
441 Views
Last Modified: 2013-11-20
Hi

I have a property sheet that consists of three property pages.  I would like the tab of the active page to be bolded.

For example.  Suppose that the titles of my 3 property pages are {"one", "two", "three"}.  Then when the user clicks on the text "two" (to select this page) then

(a) the text "two" should become bolded and

(b) the previous bolded text (if it wasn't "two") should have the bolding removed
0
Comment
Question by:mgw
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:alb66
ID: 22597042
You need an owner draw tab control.
You can start from here:
http://www.codeproject.com/KB/tabs/customtab.aspx
0
 

Author Comment

by:mgw
ID: 22604012
Hi alb66

Many thanks for your quick response.  I took a look at the code that I downloaded from the link that you recommended.

Unfortunately I do not have much experience with font setting and I was unable to determine how to set the font within the downloaded code.

Would you have any other advice?

Thanks in advance.
0
 
LVL 19

Accepted Solution

by:
alb66 earned 500 total points
ID: 22604365
You must modify the item drawing code.
In the sample, change the end part of CEnTabCtrl::DrawItem() as in the code snippet:
void CEnTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpdis)
{
	...
 
	// text
	rItem.right -= PADDING;
	FormatText(sTemp, pDC, rItem.Width());
 
	CFont boldFont;
	CFont* pOldFont = NULL;
 
	if ( bSelected )	// only for the selected item
	{
		LOGFONT logFont;
		CFont* pFont = pDC->GetCurrentFont();		// get current font
		pFont->GetLogFont( &logFont );			// get font's parameters
		logFont.lfWeight = FW_BOLD;			// change it to bold
		boldFont.CreateFontIndirect( &logFont );	// create the new font
		pOldFont = pDC->SelectObject( &boldFont );	// select it
	}
 
	pDC->SetTextColor(GetTabTextColor(bSelected));
	pDC->DrawText(sTemp, rItem, DT_NOPREFIX | DT_CENTER);
 
	if ( bSelected )
		pDC->SelectObject( pOldFont );			// restore original font
}

Open in new window

0
 

Author Closing Comment

by:mgw
ID: 31501202
Good job alb66 - that worked a treat.  Thank you.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
Unix / Linux grid computing 5 155
Doc'in system (example?) BA 7 105
NotAlone Challenge 20 83
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 …
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

813 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

11 Experts available now in Live!

Get 1:1 Help Now