Click here to Skip to main content
15,909,242 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCInternetSession Pin
FerrariDMan13-Jan-04 4:32
FerrariDMan13-Jan-04 4:32 
GeneralUninstalling Pin
act_x13-Jan-04 4:31
act_x13-Jan-04 4:31 
GeneralChanging VC++ compilers Pin
Joel Lipschultz13-Jan-04 4:19
Joel Lipschultz13-Jan-04 4:19 
QuestionCstring::find bug??? Pin
Anonymous13-Jan-04 4:15
Anonymous13-Jan-04 4:15 
AnswerRe: Cstring::find bug??? Pin
RChin13-Jan-04 5:56
RChin13-Jan-04 5:56 
Generalfatal error Pin
Goh Hui Beng13-Jan-04 4:15
Goh Hui Beng13-Jan-04 4:15 
GeneralRe: fatal error Pin
Antti Keskinen13-Jan-04 6:43
Antti Keskinen13-Jan-04 6:43 
GeneralTreeCtrl with customized background --- PROBLEM Pin
TiberiusvP13-Jan-04 4:03
TiberiusvP13-Jan-04 4:03 
Hi there!
This is my first time here, so please be kind if I do something wrong Smile | :)

I've got a tree ctrl with a customized background, and nearly everything works fine.
let me show you a pic of what i intend to do:

http://www.msuling.de/pics/whatiwant.gif[^]

I have nearly everything done, let me show you what I've got:

http://www.msuling.de/pics/whatigot_1.gif[^]
or
http://www.msuling.de/pics/whatigot_2.gif[^]

Confused | :confused: I have no clue how to make the lines and the boxes visible WITH a colored background.
If anyone outthere has an idea, I would be very pleased ! Smile | :)
Oh, right, this is the code I use in OnPaint() my MultiColorTree-Class:
void CMultiColorTree::OnPaint() 
{
	CPaintDC dc(this);
	
	// Create a memory DC compatible with the paint DC
	CDC memDC;
	memDC.CreateCompatibleDC( &dc );
	
	CRect rcClip, rcClient;
	dc.GetClipBox( &rcClip );
	GetClientRect(&rcClient);
	
	// Select a compatible bitmap into the memory DC
	CBitmap bitmap;
	bitmap.CreateCompatibleBitmap( &dc, rcClient.Width(), rcClient.Height() );
	memDC.SelectObject( &bitmap );
	
	// Set clip region to be same as that in paint DC
	CRgn rgn;
	rgn.CreateRectRgnIndirect( &rcClip );
	memDC.SelectClipRgn(&rgn);
	rgn.DeleteObject();
	
	// First let the control do its default drawing.
	CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );
	
	HTREEITEM hItem = GetFirstVisibleItem();
	
	int n = GetVisibleCount()+1;
	while( hItem && n--)
	{
		CRect rect;
		
		// Do not meddle with selected items or drop highlighted items
		UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED;
		Color_Font cf;
		
		if ( m_mapColorFont.Lookup( hItem, cf ))
		{
                       // [... not important ...]
			{
				CFont *pFontDC;
				CFont fontDC;
				LOGFONT logfont;
				
				if( cf.logfont.lfFaceName[0] != '\0' ) 
				{
					logfont = cf.logfont;
				}
				else
				{
					// No font specified, so use window font
					CFont *pFont = GetFont();
					pFont->GetLogFont( &logfont );
				}
				
				if( GetItemBold( hItem ) )
					logfont.lfWeight = 700;
				fontDC.CreateFontIndirect( &logfont );
				pFontDC = memDC.SelectObject( &fontDC );
				
				if( cf.color != (COLORREF)-1 )
					memDC.SetTextColor( RGB(0,0,0) );
				//				memDC.SetTextColor( cf.color );
				
				CString sItem = GetItemText( hItem );
				
				GetItemRect( hItem, &rect, TRUE );
				CRect tmpRect;
				tmpRect.SetRect(rect.left,rect.top,rect.right,rect.bottom);
				//tmpRect.SetRect(rect.left - (rect.left - rcClient.left),rect.top,rect.right + (rcClient.right - rect.right),rect.bottom);
				
				CBrush brush;
				brush.CreateSolidBrush(cf.color);
				//memDC.SetBkColor( GetSysColor( COLOR_WINDOW ) );
				memDC.FillRect(&tmpRect,&brush);
				memDC.SetBkColor(cf.color);
				memDC.TextOut( rect.left+2, rect.top+1, sItem );

				memDC.SelectObject( pFontDC );
			}
		}
		hItem = GetNextVisibleItem( hItem );
	}
        dc.BitBlt( rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &memDC, 
		rcClip.left, rcClip.top, SRCCOPY );
}

Thank you very much!
greetz
Tiberius

Is there a way to include pictures here?

----------------------------------------------------------
I once had a nightmare in binary --- I think there was a 2
GeneralDatabases and C++ Pin
mcsherry13-Jan-04 3:40
mcsherry13-Jan-04 3:40 
GeneralRe: Databases and C++ Pin
pankajdaga13-Jan-04 4:01
pankajdaga13-Jan-04 4:01 
GeneralRe: Databases and C++ Pin
mcsherry13-Jan-04 4:43
mcsherry13-Jan-04 4:43 
GeneralRe: Databases and C++ Pin
RChin13-Jan-04 5:41
RChin13-Jan-04 5:41 
GeneralRe: Databases and C++ Pin
mcsherry13-Jan-04 4:35
mcsherry13-Jan-04 4:35 
GeneralRe: Databases and C++ Pin
RChin13-Jan-04 5:48
RChin13-Jan-04 5:48 
GeneralRe: Databases and C++ Pin
forjer13-Jan-04 6:42
forjer13-Jan-04 6:42 
GeneralDisable ASSERT in Debug mode Pin
misha_grewal13-Jan-04 3:21
misha_grewal13-Jan-04 3:21 
GeneralRe: Disable ASSERT in Debug mode Pin
Prakash Nadar13-Jan-04 3:31
Prakash Nadar13-Jan-04 3:31 
GeneralRe: Disable ASSERT in Debug mode Pin
misha_grewal13-Jan-04 17:02
misha_grewal13-Jan-04 17:02 
GeneralRe: Disable ASSERT in Debug mode Pin
kasparov_8515-Jan-13 21:52
kasparov_8515-Jan-13 21:52 
GeneralODBC - dbf files - strange error msg Pin
Qadddd13-Jan-04 2:07
Qadddd13-Jan-04 2:07 
GeneralSockets and Memory leak Pin
Member 81460313-Jan-04 2:03
Member 81460313-Jan-04 2:03 
GeneralRe: Sockets and Memory leak Pin
Antti Keskinen13-Jan-04 3:07
Antti Keskinen13-Jan-04 3:07 
GeneralRe: Sockets and Memory leak Pin
Member 81460313-Jan-04 3:53
Member 81460313-Jan-04 3:53 
GeneralRe: Sockets and Memory leak Pin
Antti Keskinen13-Jan-04 6:35
Antti Keskinen13-Jan-04 6:35 
GeneralSimulating copy to clipboard Pin
Anonymous13-Jan-04 1:03
Anonymous13-Jan-04 1:03 

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.