Click here to Skip to main content
15,926,507 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Database Updates Pin
C++_Newbee7-Aug-07 18:09
C++_Newbee7-Aug-07 18:09 
Questionstdout Pin
baerten6-Aug-07 22:34
baerten6-Aug-07 22:34 
AnswerRe: stdout Pin
Russell'6-Aug-07 23:56
Russell'6-Aug-07 23:56 
GeneralRe: stdout Pin
baerten7-Aug-07 3:22
baerten7-Aug-07 3:22 
QuestionCatching the 'End Task' Event Pin
Programm3r6-Aug-07 22:04
Programm3r6-Aug-07 22:04 
AnswerRe: Catching the 'End Task' Event Pin
Jonathan [Darka]6-Aug-07 23:28
professionalJonathan [Darka]6-Aug-07 23:28 
AnswerRe: Catching the 'End Task' Event Pin
jk chan7-Aug-07 0:03
jk chan7-Aug-07 0:03 
Questionhow to change the device context for a status bar Pin
BlrBoy6-Aug-07 21:35
BlrBoy6-Aug-07 21:35 
Hello All..

I am trying to draw a bitmap as background for the status bar. I have derived my own status bar from CStatusBar. When I try to override OnPaint ().. it erases the default status bar messages and panes.. I tried to change the Device Context on OnCreate () and OnNCPaint () both are not working here is the code.

<br />
void CMyStatusBar::OnNcPaint()<br />
{<br />
   CDC* pdc= GetWindowDC();<br />
<br />
    CDC memdc;    <br />
    memdc.CreateCompatibleDC(pdc);    <br />
    memdc.SelectObject(m_hBmp);    <br />
    pdc->BitBlt(0, 0, <br />
        m_rectLogo.Width(), <br />
        m_rectLogo.Height(), <br />
        &memdc, 0, 0, SRCCOPY);    <br />
<br />
    ReleaseDC(pdc);    	<br />
}<br />
<br />
int CMyStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
	if (CStatusBar::OnCreate(lpCreateStruct) == -1)<br />
		return -1;<br />
<br />
	m_hBmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(), <br />
           MAKEINTRESOURCE(IDB_BKCOLOR_BMP), IMAGE_BITMAP, <br />
           0, 0, LR_CREATEDIBSECTION);<br />
<br />
        BITMAP bm;<br />
        GetObject(m_hBmp, sizeof(bm), &bm);    <br />
<br />
        m_rectLogo.left = 15;<br />
        m_rectLogo.right = 15 + bm.bmWidth;<br />
        m_rectLogo.top = 2 ;<br />
<br />
        return 0;<br />
}<br />


Next I tried to create a solid brush (for testing) in OnCreate and tried to select that object but that is also not working

<br />
int CMyStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
	if (CStatusBar::OnCreate(lpCreateStruct) == -1)<br />
		return -1;<br />
<br />
	if (!m_oBrush.CreateSolidBrush (RGB(255, 0, 0)))<br />
		AfxMessageBox ("Error in creating brush");<br />
<br />
	GetStatusBarCtrl().GetDC ()->SelectObject (&m_oBrush);<br />
<br />
         return 0;<br />
}<br />


I am unable to change the DC of the status bar.

Let me know how to draw a bitmap as back ground for a status bar?

Thanks for your time
AnswerRe: how to change the device context for a status bar Pin
jk chan7-Aug-07 0:01
jk chan7-Aug-07 0:01 
GeneralRe: how to change the device context for a status bar Pin
BlrBoy7-Aug-07 0:08
BlrBoy7-Aug-07 0:08 
AnswerRe: how to change the device context for a status bar Pin
jk chan7-Aug-07 0:28
jk chan7-Aug-07 0:28 
GeneralRe: how to change the device context for a status bar Pin
BlrBoy7-Aug-07 1:06
BlrBoy7-Aug-07 1:06 
GeneralRe: how to change the device context for a status bar Pin
jk chan7-Aug-07 2:12
jk chan7-Aug-07 2:12 
GeneralRe: how to change the device context for a status bar Pin
BlrBoy7-Aug-07 3:18
BlrBoy7-Aug-07 3:18 
GeneralRe: how to change the device context for a status bar Pin
jk chan7-Aug-07 15:01
jk chan7-Aug-07 15:01 
GeneralRe: how to change the device context for a status bar Pin
BlrBoy7-Aug-07 18:05
BlrBoy7-Aug-07 18:05 
GeneralRe: how to change the device context for a status bar Pin
jk chan7-Aug-07 19:59
jk chan7-Aug-07 19:59 
GeneralRe: how to change the device context for a status bar Pin
jk chan7-Aug-07 20:05
jk chan7-Aug-07 20:05 
QuestionHow to change a Dialog Form's scrollbar's color? Pin
Peter, Chan6-Aug-07 21:23
Peter, Chan6-Aug-07 21:23 
AnswerRe: How to change a Dialog Form's scrollbar's color? Pin
jk chan6-Aug-07 23:53
jk chan6-Aug-07 23:53 
AnswerRe: How to change a Dialog Form's scrollbar's color? Pin
Hamid_RT7-Aug-07 19:19
Hamid_RT7-Aug-07 19:19 
QuestionHow to save a html file in C#.Net Pin
sundeep.A6-Aug-07 21:20
sundeep.A6-Aug-07 21:20 
AnswerRe: How to save a html file in C#.Net Pin
Jonathan [Darka]6-Aug-07 23:31
professionalJonathan [Darka]6-Aug-07 23:31 
AnswerRe: How to save a html file in C#.Net Pin
Hamid_RT7-Aug-07 19:18
Hamid_RT7-Aug-07 19:18 
QuestionWeb Based Installation Pin
vipin_nvk6-Aug-07 21:03
vipin_nvk6-Aug-07 21: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.