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

C / C++ / MFC

 
GeneralReplacing ComboBox arrow-button Pin
21-Mar-01 9:41
suss21-Mar-01 9:41 
GeneralHelp me Please! Bitmap UI probs Pin
21-Mar-01 8:36
suss21-Mar-01 8:36 
GeneralRe: Help me Please! Bitmap UI probs Pin
Chris Losinger21-Mar-01 9:29
professionalChris Losinger21-Mar-01 9:29 
GeneralRe: Help me Please! Bitmap UI probs Pin
21-Mar-01 9:52
suss21-Mar-01 9:52 
GeneralRe: Help me Please! Bitmap UI probs Pin
Chris Losinger21-Mar-01 11:26
professionalChris Losinger21-Mar-01 11:26 
GeneralRe: Help me Please! Bitmap UI probs Pin
Michael Dunn21-Mar-01 16:58
sitebuilderMichael Dunn21-Mar-01 16:58 
GeneralRe: Help me Please! Bitmap UI probs Pin
22-Mar-01 12:03
suss22-Mar-01 12:03 
GeneralRe: Help me Please! Bitmap UI probs Pin
23-Mar-01 9:14
suss23-Mar-01 9:14 
Just in case, this is what is really working for me since 5 yeras! Use it if you wish! Smile | :)

void CxxxxxxDlg::OnPaint() 
{

    CPaintDC dc(this); // device context for painting

	if (IsIconic())
	{
		

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{

	CDC memDC;
	memDC.CreateCompatibleDC(NULL);
	CBitmap Bitmap;
	Bitmap.LoadBitmap(IDB_BITMAP_BACK);
	memDC.SelectObject(&Bitmap);
	
	CRect rect;
        GetClientRect(&rect);

	LPBITMAPINFOHEADER m_pBmInfoHeader;     
    
	UINT width  = (UINT) m_pBmInfoHeader->biWidth;
	UINT height = (UINT) m_pBmInfoHeader->biHeight; 

	dc.BitBlt(rect.left,
				rect.top,
				width,
				height,
				&memDC,
				0,
				0,
				SRCCOPY);
	

	CDialog::OnPaint();

	}

}


And there has never been a need for WM_ERASEBACKGND so far! Dead | X|

PS. For your next questions, to prduce Transparency you must have Mask bitmaps and prepare either by writing code or yet simpler just produce a B&W version of your bitmap and then use it as a mask.

Keep in mind that if you are going to use bitmaps as a background to your dialog window, you must go some steps further than just tranparenting the bitmap, you gotta create a region from it and let that
region be the dialog drwaing clip regions/window.

Advice: Use the samples from codeguru or even here on codeproject and save yourself a lot of time! Wink | ;)

However, Good Luck!
QuestionHow to turn status bar, menu bar, tool bar, title bar off? Pin
Richard Cheng21-Mar-01 6:23
Richard Cheng21-Mar-01 6:23 
GeneralAccelerator Pin
confalonieri21-Mar-01 3:57
confalonieri21-Mar-01 3:57 
QuestionCComboBox - how to react to enter i editbox? Pin
21-Mar-01 2:19
suss21-Mar-01 2:19 
AnswerRe: CComboBox - how to react to enter i editbox? Pin
PJ Arends22-Mar-01 6:22
professionalPJ Arends22-Mar-01 6:22 
QuestionDundas Ultimate Grid -- enhanced Version? Pin
Uwe Keim20-Mar-01 19:21
sitebuilderUwe Keim20-Mar-01 19:21 
AnswerRe: Dundas Ultimate Grid -- enhanced Version? Pin
Holger Persch20-Mar-01 19:48
Holger Persch20-Mar-01 19:48 
GeneralWeb Accessories Pin
Marcelo Nogueira Magri20-Mar-01 14:50
Marcelo Nogueira Magri20-Mar-01 14:50 
GeneralRe: Web Accessories Pin
Erik Thompson21-Mar-01 7:48
sitebuilderErik Thompson21-Mar-01 7:48 
GeneralSetWindowsHookEx Pin
Conor Hunt20-Mar-01 10:38
Conor Hunt20-Mar-01 10:38 
GeneralRe: SetWindowsHookEx Pin
Michael Dunn20-Mar-01 18:04
sitebuilderMichael Dunn20-Mar-01 18:04 
Generaldialogbox Pin
20-Mar-01 8:23
suss20-Mar-01 8:23 
GeneralRe: dialogbox Pin
Christian Graus20-Mar-01 11:53
protectorChristian Graus20-Mar-01 11:53 
GeneralGraphic Question Pin
Richard Cheng20-Mar-01 6:33
Richard Cheng20-Mar-01 6:33 
GeneralRe: Graphic Question Pin
Tim Deveaux20-Mar-01 7:36
Tim Deveaux20-Mar-01 7:36 
GeneralRe: Graphic Question Pin
Richard Cheng20-Mar-01 8:46
Richard Cheng20-Mar-01 8:46 
GeneralRe: Graphic Question Pin
Tim Deveaux20-Mar-01 10:03
Tim Deveaux20-Mar-01 10:03 
GeneralRe: Graphic Question Pin
Christian Graus20-Mar-01 11:49
protectorChristian Graus20-Mar-01 11:49 

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.