Click here to Skip to main content
15,911,360 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Detect user's language for user interface Pin
Moak14-Apr-08 8:38
Moak14-Apr-08 8:38 
GeneralRe: Detect user's language for user interface Pin
Nemanja Trifunovic14-Apr-08 9:29
Nemanja Trifunovic14-Apr-08 9:29 
GeneralRe: Detect user's language for user interface Pin
Randor 14-Apr-08 8:05
professional Randor 14-Apr-08 8:05 
GeneralRe: Detect user's language for user interface Pin
Nemanja Trifunovic14-Apr-08 8:31
Nemanja Trifunovic14-Apr-08 8:31 
GeneralRe: Detect user's language for user interface Pin
Randor 14-Apr-08 9:00
professional Randor 14-Apr-08 9:00 
GeneralRe: Detect user's language for user interface Pin
Randor 14-Apr-08 9:02
professional Randor 14-Apr-08 9:02 
GeneralProblem customizing tree control [modified] Pin
Jim Crafton14-Apr-08 4:31
Jim Crafton14-Apr-08 4:31 
GeneralRe: Problem customizing tree control Pin
enhzflep14-Apr-08 5:02
enhzflep14-Apr-08 5:02 
Glad to hear you solved the problem. I'll have to keep this approach in mind in the future.

An alternative that I use myself, is to just handle the WM_NCCALCSIZE & WM_NCPAINT messages. For example
LRESULT CLeftView::OnNcCalcSize(WPARAM wParam, LPARAM lParam)
{
	RECT *prect = (RECT *)lParam;

	// let the old wndproc allocate space for the borders,
	// or any other non-client space.
	WndProcDefault(GetHwnd(), WM_NCCALCSIZE, wParam, lParam); 

	// calculate what the size of each window border is,
	// we need to know the location of the non-client area.
	m_ncRect.left   = prect->left;
	m_ncRect.right  = prect->right;
	m_ncRect.top    = prect->top;
	m_ncRect.bottom = prect->top + 22;

	// now we can allocate additional space
	prect->top += 24;

	// take scrollbar into account
	SCROLLBARINFO sbi;
	::ZeroMemory(&sbi, sizeof(SCROLLBARINFO));
	sbi.cbSize = sizeof(sbi);
	if (::GetScrollBarInfo(GetHwnd(), OBJID_VSCROLL, &sbi))
		if (!(sbi.rgstate[0] & STATE_SYSTEM_INVISIBLE))
			m_ncRect.right  += ::GetSystemMetrics(SM_CXVSCROLL);

	// that's it! Easy or what!
	return 0L;
}

and
LRESULT CLeftView::OnNcPaint(WPARAM wParam, LPARAM lParam)
{
	// let the old window procedure draw the borders / other non-client
	// bits-and-pieces for us.
	WndProcDefault(GetHwnd(), WM_NCPAINT, wParam, lParam);

	// get device context
	HDC hDC = ::GetWindowDC(GetHwnd());
	
	// make sure there is some distance (2 pixels) between the non-client and client area
	RECT rc;
	rc.left   = m_ncRect.left;
	rc.right  = m_ncRect.right;
	rc.top    = m_ncRect.bottom;
	rc.bottom = m_ncRect.bottom + 2;
	HBRUSH hBrush = ::CreateSolidBrush(RGB(248, 249, 252));
	::FillRect(hDC, &rc, hBrush);
	::DeleteObject(hBrush);

	// draw the title bar...
    if (isThemed != 0)
       drawVistaTitleBar(hDC, "Item Library");
    else
	    DrawTitleBar(hDC);

	// release device context
	::ReleaseDC(GetHwnd(), hDC);

	// that's it!
	return 0L;
}


Thanks to WM_NCCALCSIZE's code the scroll-bars draw correctly too. http://i291.photobucket.com/albums/ll304/enhzflep/treeView.jpg[^]
GeneralRe: Problem customizing tree control Pin
Jim Crafton14-Apr-08 5:08
Jim Crafton14-Apr-08 5:08 
GeneralRe: Problem customizing tree control Pin
Jim Crafton14-Apr-08 5:11
Jim Crafton14-Apr-08 5:11 
GeneralRe: Problem customizing tree control [modified] Pin
enhzflep14-Apr-08 5:49
enhzflep14-Apr-08 5:49 
GeneralFind All Window Pin
john563214-Apr-08 3:52
john563214-Apr-08 3:52 
GeneralRe: Find All Window Pin
JudyL_MD14-Apr-08 4:10
JudyL_MD14-Apr-08 4:10 
GeneralRe: Find All Window Pin
john563214-Apr-08 4:14
john563214-Apr-08 4:14 
GeneralRe: Find All Window Pin
JudyL_MD14-Apr-08 4:28
JudyL_MD14-Apr-08 4:28 
QuestionRe: Find All Window Pin
David Crow14-Apr-08 4:13
David Crow14-Apr-08 4:13 
QuestionFont/FontSize Pin
C++NewBe14-Apr-08 2:34
C++NewBe14-Apr-08 2:34 
GeneralRe: Font/FontSize Pin
Cedric Moonen14-Apr-08 2:38
Cedric Moonen14-Apr-08 2:38 
GeneralRe: Font/FontSize Pin
CPallini14-Apr-08 3:27
mveCPallini14-Apr-08 3:27 
QuestionRe: Font/FontSize Pin
David Crow14-Apr-08 3:44
David Crow14-Apr-08 3:44 
GeneralRe: Font/FontSize Pin
C++NewBe14-Apr-08 3:52
C++NewBe14-Apr-08 3:52 
QuestionRe: Font/FontSize Pin
David Crow14-Apr-08 3:56
David Crow14-Apr-08 3:56 
GeneralRe: Font/FontSize Pin
C++NewBe14-Apr-08 4:04
C++NewBe14-Apr-08 4:04 
QuestionRe: Font/FontSize Pin
David Crow14-Apr-08 4:15
David Crow14-Apr-08 4:15 
GeneralRe: Font/FontSize Pin
C++NewBe14-Apr-08 4:21
C++NewBe14-Apr-08 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.